Eccomi nel mio ufficio.
Posto l'intero programma e il dump del file che ne esce:
Ecco il dump del file "prova.dat" prodotto dal programma:codice:#include <stdio.h> #include <windows.h> struct Mio_Header { int HD_magic_byte; char HD_GUID[16]; int HD_flags; int HD_FileAttribute; INT64 HD_Time1; INT64 HD_Time2; INT64 HD_Time3; int HD_FileLength; int HD_INumber; int HD_ShowWnd; int HD_HKey; int HD_Reserved[2]; } the_header; int main(int argc, char **argv) { FILE *fileOut; the_header.HD_magic_byte = -1; the_header.HD_GUID[0] = (char) 0xFF; the_header.HD_GUID[1] = (char) 0xFF; the_header.HD_GUID[2] = (char) 0xFF; the_header.HD_GUID[3] = (char) 0xFF; the_header.HD_GUID[4] = (char) 0xFF; the_header.HD_GUID[5] = (char) 0xFF; the_header.HD_GUID[6] = (char) 0xFF; the_header.HD_GUID[7] = (char) 0xFF; the_header.HD_GUID[8] = (char) 0xFF; the_header.HD_GUID[9] = (char) 0xFF; the_header.HD_GUID[10] = (char) 0xFF; the_header.HD_GUID[11] = (char) 0xFF; the_header.HD_GUID[12] = (char) 0xFF; the_header.HD_GUID[13] = (char) 0xFF; the_header.HD_GUID[14] = (char) 0xFF; the_header.HD_GUID[15] = (char) 0xFF; the_header.HD_flags = -1; the_header.HD_FileAttribute = -1; the_header.HD_Time1 = (INT64) -1; the_header.HD_Time2 = (INT64) -1; the_header.HD_Time3 = (INT64) -1; the_header.HD_FileLength = -1; the_header.HD_INumber = -1; the_header.HD_ShowWnd = -1; the_header.HD_HKey = -1; the_header.HD_Reserved[0] = the_header.HD_Reserved[1] = -1; if ((fileOut = fopen("prova.dat", "wb")) == NULL) { printf("Errore nella creazione del file!\n\n"); exit(1); } fwrite(&the_header, sizeof(struct Mio_Header), 1, fileOut); fclose(fileOut); return 0; }
Come si può notare ci sono quei 4 byte a zero esattamente prima dei tre valori INT64 (mi sono accorto che nei post precedenti avevo scritto "dopo", non avendo il codice davanti...).codice:0000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0010 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 0020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0030 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0040 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Ciao.![]()



Rispondi quotando