We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,124 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Text files help

It doesn't read the first line of the text file. Why?

pFile = fopen(user, "r");
    if(pFile == NULL)
    printf("File doesn't exist!\n");

    if(pFile != NULL){
    while(fgets(line,80,pFile) != NULL)
    {
    fgets(search,1000,pFile);
    printf("%s\n",line);
    .
    .
    .
    .
    .
2
Contributors
1
Reply
14 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
Question
Answered
jodzjcm
Newbie Poster
16 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

It can read the first line just fine
quick question why are you using fgets twice?

zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14
Question Answered as of 1 Year Ago by zeroliken

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0745 seconds using 2.7MB