Original Post
I wrote a hydrology develop kit for my friends.They can only use Turbo C, it is old,though. :),I find a big problem in my programme. My expression is poor ,so it's better to let my code say it.Look at this code:
#include<stdio.h>
#include<stdlib.h>
int main()
{
unsigned char* image;
FILE* file;
image=NULL;
image=(unsigned char*)malloc(800*600*sizeof(unsigned char));
memset(image,1,800*600);
if(image==NULL)
{
printf("error allocating memory");
return 1;
}
file=fopen("text.dat","wb");
if(file==NULL)
{
printf("cannt open output file");
return 2;
}
fwrite(image,800*600,1,file);
free(image);
fclose(file);
return 0;
}
I compile in turbo c2.0,small compile mode,but that the file could not been created.Whats the reasons?and solution? --*---*---merry christmas---*---*---