Raised This Month: $ Target: $400
 0% 

Reading from a file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-28-2011 , 13:50   Re: Reading from a file
Reply With Quote #4

Quote:
Originally Posted by wrecked_ View Post
Instead of using fgets() within the while condition, you should use it within the brackets and use feof() for the condition.

ex:
Code:
while( fgets() ) {     // ... }
->
Code:
while( !feof() ) // the ! is making sure it's not the end of the file {     fgets()     // ... }
That won't make a difference.
fgets() is perfectly fine to use as the condition in the loop.

@killergirl
Use trim() after fgets() so the new line character is removed from the end of the string.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode