non ci avevo pensato a fare una struttura in quel modo, effetivamente così stampa il tipo di dato anche l'operatore <<, il problema è che da dati sfasati, è colpa proprio di << sia su file sia su standard output su monitor(una message box neanche si visualizza).
Al momento ho dovuto fare un piccolo "sacrificio" e usare funzioni C in un programma C++, ma era previsto nel progetto usare anche C, ho fatto così:
codice:
...
FILE* file = fopen("a.txt", "w");
fprintf(file, "%I64d\n", getSpace(TOTAL));
fprintf(file, "%I64d\n", getSpace(USED));
fprintf(file, "%I64d\n", getSpace(FREE));
fclose(file);
...
codice:
...
const int FREE = 1;
const int TOTAL = 2;
const int USED = 3;
...
unsigned __int64 getSpace(int use) {
__int64 lpFreeBytesAvaibleToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes;
GetDiskFreeSpaceEx("C:\\", (PULARGE_INTEGER)&lpFreeBytesAvaibleToCaller,
(PULARGE_INTEGER) &lpTotalNumberOfBytes,
(PULARGE_INTEGER) &lpTotalNumberOfFreeBytes);
__int64 space = NULL;
switch(use) {
case FREE:
space = lpTotalNumberOfFreeBytes;
break;
case USED:
space = lpTotalNumberOfBytes - lpTotalNumberOfFreeBytes;
break;
case TOTAL:
space = lpTotalNumberOfBytes;
break;
}
return space;
}
...
grazie a tutti per l'aiuto