You are using C++ and getting that problem, which we do not handle here.
Incorrect file creation date
Hello
I'm trying to create files with C++ but the creation time displayed is incorrect.Here's the code:[CODE]do
{
++item;
sprintf(pathDirFile,"%s/%s%03d.bmp",pathDir,file1,item); f1 = fopen(pathDirFile,"r");
sprintf(pathDirFile,"%s/%s%03d.txt",pathDir,file2,item); f2 = fopen(pathDirFile,"r");
if (f1) fclose(f1);
if (f2) fclose(f2);
} while (f1 != NULL || f2 != NULL);
sprintf(pathDirFile,"%s/%s%03d.bmp",pathDir,file1,item); f1 = fopen(pathDirFile,"wb");
sprintf(pathDirFile,"%s/%s%03d.txt",pathDir,file2,item); f2 = fopen(pathDirFile,"w");
fprintf(f2,...);
fwrite(buffer,1,sizeBuffer,f1);
fclose(f2);
fclose(f1);[/CODE]This code creates two files for me:- ****.bmp- ScalesXXX.txtwith XXX the following number of the files that exist in the directory.Everything works fine, except when I delete the files (it happens that I delete all but Image001.bmp and Scales001.txt) and I restart; He creates two files for me (Image002.bmp and Scales002.txt), but the creation date of Image002.bmp is wrong because it is older than the creation time (e.g. 10:15) while the creation date of Scales002.txt is correct (e.g. 11:38). If I delete these two files and restart, I get the same result (e.g. 10:15 for Image002.bmp and 11:39 for Image002.txt). The other files (Image003.bmp and Scales003.txt) created in a row always have a correct time. But if I delete all these files (Image002.bmp, Scales002.txt, Images003.bmp and Scales003.txt) and restart, I still have the same thing (e.g. 10:15 for Image002.bmp and 11:40 for Image002.txt). There must be one minute between the time I delete the files and the time I launch the application.I don't know how this is done and where this old time is memorized.Does anyone know where this old time is memorized please?Does anyone know how to get the correct creation time (the same for both files, i.e. the recent time) please?
Windows for home | Previous Windows versions | Files, folders, and storage
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
3 additional answers
Sort by: Most helpful
-
Christian 2B 18,536 Reputation points Volunteer Moderator2024-08-08T09:02:17+00:00 Bonjour Bill Smithers
Ce fil est un doublon de celui-ci : https://answers.microsoft.com/fr-fr/windows/forum/windows_7-files/date-de-cr%c3%a9ation-de-fichier-incorrecte/3739df14-b7d2-4f76-ae7c-907d51a5e4da?messageId=3a4b60be-12ed-43f3-ac6b-5ea469234034
Bonne continuation.
-
Anonymous
2024-08-07T21:26:12+00:00 The dates are not ceate by the programm C++. It's windows who create the date.
-
Anonymous
2024-08-07T12:26:12+00:00 Hello I'm trying to create files with C++ but the creation time displayed is incorrect.Here's the code:[CODE]do
{
++item;
sprintf(pathDirFile,"%s/%s%03d.bmp",pathDir,file1,item); f1 = fopen(pathDirFile,"r");
sprintf(pathDirFile,"%s/%s%03d.txt",pathDir,file2,item); f2 = fopen(pathDirFile,"r");
if (f1) fclose(f1);
if (f2) fclose(f2);
} while (f1 != NULL || f2 != NULL);
sprintf(pathDirFile,"%s/%s%03d.bmp",pathDir,file1,item); f1 = fopen(pathDirFile,"wb");
sprintf(pathDirFile,"%s/%s%03d.txt",pathDir,file2,item); f2 = fopen(pathDirFile,"w");
fprintf(f2,...);
fwrite(buffer,1,sizeBuffer,f1);
fclose(f2);
fclose(f1);[/CODE]This code creates two files for me:- ****.bmp- ScalesXXX.txtwith XXX the following number of the files that exist in the directory.Everything works fine, except when I delete the files (it happens that I delete all but Image001.bmp and Scales001.txt) and I restart; He creates two files for me (Image002.bmp and Scales002.txt), but the creation date of Image002.bmp is wrong because it is older than the creation time (e.g. 10:15) while the creation date of Scales002.txt is correct (e.g. 11:38). If I delete these two files and restart, I get the same result (e.g. 10:15 for Image002.bmp and 11:39 for Image002.txt). The other files (Image003.bmp and Scales003.txt) created in a row always have a correct time. But if I delete all these files (Image002.bmp, Scales002.txt, Images003.bmp and Scales003.txt) and restart, I still have the same thing (e.g. 10:15 for Image002.bmp and 11:40 for Image002.txt). There must be one minute between the time I delete the files and the time I launch the application.I don't know how this is done and where this old time is memorized.Does anyone know where this old time is memorized please?Does anyone know how to get the correct creation time (the same for both files, i.e. the recent time) please?There is another Community for C++ Questions: