bonjour, j'ai créé une structure:
typedef struct headerstruct{
char nom[32];
int taille;
long debut;
}headerstruct, *LPHEADERST;
puis ensuite j'écris une variable de ce type dans un fichier:
struct headerstruct fileheader;
int valeurtmp=MYFILEVERSION;
fileheader.debut=0;
strcpy(fileheader.nom,"FileVersion");
fileheader.taille=sizeof(valeurtmp);
fileheader.debut+=sizeof(headerstruct);
WriteFile(fileproject,&fileheader,sizeof(headerstruct),&numberofbytewritten,NULL);
je ferme mon fichier, puis si je l'ouvre avec le bloc note j'ai bien 40 octets commençant par "FileVersion".
Mais le problème c'est que si dans mon application je reli le fichier:
struct headerstruct fileheader;
ReadFile(fileproject,&fileheader,sizeof(headerstruct),&numberofbyteread,NULL);
je ne retrouve rien du tout dans fileheader.nom, or fileheader.taille et fileheader.debut ont bien les valeurs que j'avais enregistré précédemment.
Je ne vois pas pourquoi le premier membre de ma structure ne prend pas "FileVersion" qui convient très bien pour un char nom[32];
