LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-28-2011, 05:42 AM   #16
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335

My $0.02...

In C++, getline() returns the file stream that is being used; and when a file-stream is operated on as a conditional value, it is converted to a bool via a converter method that is associated with the stream object.

Thus, the following code:
Code:
   ...
   while(!myfile.eof()) {
      getline(myfile, line);
      ...
   }
can be reduced to:
Code:
   ...
   while (getline(myfile, line)) {
      ...
   }
 
Old 10-30-2011, 08:40 AM   #17
akshay_satish
Member
 
Registered: May 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
thanks guys for your inputs.. ) cheers
 
Old 11-04-2011, 03:51 AM   #18
akshay_satish
Member
 
Registered: May 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
....

Last edited by akshay_satish; 11-04-2011 at 03:57 AM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble reading btmp brownsman Linux - Security 3 09-01-2010 11:34 AM
Trouble reading from serial port. rkjnsn Programming 13 12-04-2009 11:57 PM
Having trouble reading from serial port glo Linux - Newbie 0 02-09-2007 10:42 AM
Trouble Reading Newgroups Setheck Linux - Software 1 07-05-2005 06:18 PM
Having trouble reading a floppy cestor Linux - General 1 05-29-2002 11:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration