I wanted to display the contents of any file on the console;so I wrote the following piece of C code:
#include
int main(void)
{
FILE *P;int c;
P=fopen(“path”,”mode”);
if(P==NULL){puts(“can’t open file”); getch();return 0;};
else do{
c=getc(P);
printf(“%c”,c);
}while(c!=EOF);
getch();fclose(P);return 0;
}
PROBLEM:- I get the output “can’t open file” Tried various combinations of file extensions/folders(like C:\TC\BIN\file.txt) but that didn’t help….
Also I wud like to create an application using the code above so that when the file is clicked,the text goes to console.I don’t wan’t to create a zipped file but kindda “embed” it into code.Also such a file must not EAT RAM…