Sign in to follow this  

integer file

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

there is a txt file of integers . while reading the file by fscanf(file*,"%d") , how to detect end of file .i tried using EOF or null but it is not working help please thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
This might work.

FILE *fin;
int count=0;
int value;

fin=fopen(FILE_name,"r");
if (fin) {
while ( fscanf(fin, "%d", &value) != EOF ) count++;
}



no, it is facing same problem ............


is a file size of 2307 kb too big for this program to handle??????????

Share this post


Link to post
Share on other sites
Quote:
Original post by y2jsave
also it is giving a warning
out of memory allocating 86044 bytes


Then show the code where this happens. The file reading code you've shown doesn't allocate any memory.

Share this post


Link to post
Share on other sites
sorry dudes

actually now i have found the error

actually the file_name which i was giving was wrong (spelling mistake)
after correcting it, the code is working

sorry once again

Share this post


Link to post
Share on other sites

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this