Hi,
I got this message "Windows has triggered a breakpoint in inout.exe. This may be due to a corruption of the heap, and indicates a bug in inout.exe or any of the DLLs it has loaded. The output window may have more diagnostic information" while debugging the following program in VC 2005 Express:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char file[]="test.txt";
FILE*fp=fopen(file,"w");
for (int i=0;i<200;i++) fprintf(fp,"%d ",255);
fclose(fp);
fp=fopen(file,"r");
unsigned char*ptr;
ptr=(unsigned char*)malloc(5*sizeof(unsigned char));
for (int i=0;i<5;i++)fscanf(fp,"%d",ptr+i);
fclose(fp);
free(ptr);
return 0;
}
What's the problem with my code? Thanks in advance!