0

hi. we have this project, and we have to open a file where we will get what we need to evaluate. The problem is I can't move on to my project because the eclipse (using mingw compiler) can't build my source code. Here's my source code:

#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>
#include<string.h>
int main(){
	FILE *filename;
	char *name = NULL;
	
	if((filename = fopen("snplc.txt","r"))== NULL){
		printf("FIle could not be open");
	}	
	else
	{
		while(!(feof(filename))){
			fgets(name, 40, filename);
			printf("%s", name);
		}
	}
	fclose(filename);	
	return 0;
}

and whenever i try to build it in eclipse, it said that: "there's nothing to build". and when i try to run it, nothing shows. I dont know what happened, but when i first tried it, it was okay. and it was printing the strings in that file. but when i showed it to my partner a week later, it says there's nothing to build. i'm sure i didnt change anything. please help me!! badly need help!

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by kings_mitra
0

First of all, if its an already build project then further builds are going to give that message to you. So you need clean it with the "Clean Project" option and then can build it again. Anyways, if you have done any changes to any source code then build option itself is enough.

Secondly, if it not showing any output after running then check for the file whether data is still there or it is an empty one ???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.