The first mistake which you have here is using feof function and i cant really see anywhere that you are trying to read something from a file. If you are trying to read from a file you need to open a file first
Read this on why feof shouldn't be used FEOFCode:FILE *ptr; if( ( ptr = fopen( <filename>, <mode> ) ) == NULL ) { printf("Error: File cannot be opened\n"); return 1; } and then read the file
ssharish