W
Weichao Wang
Hi all,
I use the following code in a test program to test the use of fwrite(). But
the program just runs to the fwrite() and throws the error "Unhandled
exception in test.exe(MSVCRTD.DLL): 0xC00000005: Access Violation". I've
tested with or without the cast (const void*). But it makes no difference.
Can you give me tips on how to use fwrite()? many thanks in advance!
FILE *f = fopen("test.dat", "wb");
if (!f)
return;
short s = 23456;
long lo = 123456789;
fwrite((const void*)s, sizeof(short), 1, f);
fwrite((const void*)lo, sizeof(long), 1, f);
fclose(f);
I use the following code in a test program to test the use of fwrite(). But
the program just runs to the fwrite() and throws the error "Unhandled
exception in test.exe(MSVCRTD.DLL): 0xC00000005: Access Violation". I've
tested with or without the cast (const void*). But it makes no difference.
Can you give me tips on how to use fwrite()? many thanks in advance!
FILE *f = fopen("test.dat", "wb");
if (!f)
return;
short s = 23456;
long lo = 123456789;
fwrite((const void*)s, sizeof(short), 1, f);
fwrite((const void*)lo, sizeof(long), 1, f);
fclose(f);