CODE:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#define fname "c:\rannum.f"
main()
{
FILE *fp;
int x,ran;
srand((unsigned int) clock());
fp = fopen(fname, "wb");
for (x=0;x<21;x++)
{
ran = rand() % 999 + 1;
fwrite(&ran,sizeof(int),1,fp);
}
fclose(fp);
printf("\n\nFile Was Successfully Created!");
while(getchar()!='\n');
while(getchar()!='\n');
ExitToShell();
}
i have tried this code on code warrior on mac and works fine
but it doesnt work on windows under Dev-C++/
error:
1 A:\U2_a4_1.c
`#include' expects "FILENAME" or <FILENAME>
i also tried putting #define before header files and it gave me this
error:
main.c C:\DEV-C++\lib/libmingw32.a(main.o)(.text+0x8d)
undefined reference to `WinMain@16'