Well, i did an Application which creates a text file and saves it in an ordinary location, yesterday it was working good, but now when i try to compile in Dev c++ it shows me around five houndred error messages, all related of “windows.h” library, but, if it was working yestarday and i didnt modify my code i don’t know what’s happening
here is the code
#include<time.h>
#include<stdio.h>
#include<windows.h>
#include<string.h>
int main(int argc, char *argv[])
{
srand(time(NULL));
char dir[100];
strcpy(dir,"C:\\Users\\Hp\\Documents");
char last[10]=".txt";
int i;
char obt[10]="cadenas",num[5];
int numarchivos=rand()%10;
char chains[30][30]={"Hi","Goodbye","Sistems","Operative","Linux","Windows","UNIX","Bye","Seeyou","code"};
HANDLE hFile;
BOOL bFile;
DWORD numberofbytes;
DWORD numberwritten=0;
for(i=0;i<numarchivos;i++){
numberofbytes=strlen(chains[i]);
sprintf(num,"%d",i);
strcat(dir,obt);
strcat(dir,num);
strcat(dir,last);
hFile= CreateFile(dir,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile== INVALID_HANDLE_VALUE){
printf("CreateFile failed
");}
else printf("CreateFile Success!
");
bFile= WriteFile(hFile,chains[i],numberofbytes,&numberwritten,NULL);
if(bFile== FALSE){ printf("Write Failed!
");
}
printf("Write Success!
");
CloseHandle(hFile);
strcpy(dir,"C:\\Users\\Hp\\Documents");
}
return 0;
}
Some of the Error messages that the compiler throws are
3 C:\Dev-Cpp\include\windows.h:48, from C:\Users\Hp\Documents\app.c In file included from C:/Dev-Cpp/include/windows.h:48, from C:\Users\Hp\Documents\app.c
3 C:\Users\Hp\Documents\app.c from C:\Users\Hp\Documents\app.c
263 C:\Dev-Cpp\include\windef.h syntax error at '##' token
263 C:\Dev-Cpp\include\windef.h syntax error before '{' token
296 C:\Dev-Cpp\include\windef.h syntax error before "HCURSOR"