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!

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 ???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.