try to make a binary file
=== Turbo C ++ 3.0 == BYTE randBuf[512]; int i=0; for(i=0;i<512;i++){ rdnBuf[i] = i%255; //rdnBuf[i] = (BYTE)((double)rand() / ((double)RAND_MAX + 1) * 255);
}
FILE *pFile; pFile = fopen("A.bin","w"); fwrite(randBuf,sizeof(BYTE),512,pFile); fclose(pFile);
===================== ok ,then , open the file by notepad++ and to use hex editor to check the value of the binary file the value of 1st line is ....
00 01 02 03 04 05 06 07 08 09 0d 0a ..............
The address 0x0A should be 0a... but it look like 0d?
should be pFile = fopen("A.bin","wb");
sry n this case, windows os = 0D 0A i think windows auto convert the newline('\n')or 0x0A into 0x0D0A (it's EOL) in text mode.
try to make a binary file
=== Turbo C ++ 3.0 ==
BYTE randBuf[512];
int i=0;
for(i=0;i<512;i++){
rdnBuf[i] = i%255;
//rdnBuf[i] = (BYTE)((double)rand() / ((double)RAND_MAX + 1) * 255);
}
FILE *pFile;
pFile = fopen("A.bin","w");
fwrite(randBuf,sizeof(BYTE),512,pFile);
fclose(pFile);
=====================
ok ,then , open the file by notepad++ and to use hex editor to check the value of the binary file
the value of 1st line is ....
00 01 02 03 04 05 06 07 08 09 0d 0a ..............
The address 0x0A should be 0a... but it look like 0d?
should be
pFile = fopen("A.bin","wb");
sry
n this case, windows os = 0D 0A
i think windows auto convert the newline('\n')or 0x0A into 0x0D0A (it's EOL) in text mode.