1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
//creation
hTempFile = CreateFile((LPTSTR) szTempFileName, // file name
GENERIC_READ | GENERIC_WRITE,
0, // do not share
NULL, // default security
CREATE_ALWAYS, // overwrite existing
FILE_ATTRIBUTE_NORMAL,// normal file
NULL); // no template
// ecriture
int nbelms_init=100;
fSuccess = WriteFile(hTempFile, (char*)&nbelms_init, sizeof(int), &dwBytesWritten, NULL); //fSuccess=1
//lecture
int nbelms_res=0;
bool chk1 = ReadFile(hTempFile, (char*)&nbelms_res, sizeof(int), &dwBytesRead, NULL);
//chk1=true mais nbelms_res=0 et GetLastError()->"Chemin d'accès introuvable" |
Partager