私は次のコードを持っています:
int main(int argc, char** argv) {
onelog a;
std::cout << "a new project";
//creates a file as varuntest.txt
ofstream file("C:\\users\\Lenovo\\Documents\\varuntest.txt", ios::app);
SYSTEMTIME thesystemtime;
GetSystemTime(&thesystemtime);
thesystemtime.wDay = 07;//changes the day
thesystemtime.wMonth = 04;//changes the month
thesystemtime.wYear = 2012;//changes the year
//creation of a filetimestruct and convert our new systemtime
FILETIME thefiletime;
SystemTimeToFileTime(&thesystemtime,&thefiletime);
//getthe handle to the file
HANDLE filename = CreateFile("C:\\users\\Lenovo\\Documents\\varuntest.txt",
FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
//set the filetime on the file
SetFileTime(filename,(LPFILETIME) NULL,(LPFILETIME) NULL,&thefiletime);
//close our handle.
CloseHandle(filename);
return 0;
}
さて、問題は次のとおりです。ファイルのプロパティを確認したときにのみ、変更日が変更されます。私は尋ねる必要があります。
変更日ではなく、ファイルの作成日を変更するにはどうすればよいですか?
ありがとう
この初心者のためにいくつかのコードを教えてください。