how to notify the EOF?

This is a discussion on how to notify the EOF? within the C++ Programming forums, part of the General Programming Boards category; what should i put in the while condition? Code: ifstream file3("idreport.txt"); char buf1[20],buf2[20]; while ( this is not the END ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    117

    how to notify the EOF?

    what should i put in the while condition?

    Code:
    ifstream file3("idreport.txt");
    	char buf1[20],buf2[20];
    	while (this is not the END OF FILE)
    	{
    	file3.getline(buf1,20,' ');
    	file3.getline(buf2,20,'\n');
    	cout << "buf 1 is" << buf1 << "\n";
    	cout << "buf2 is" << buf2 << "\n";
    	}
    	file3.close();

    thank you for helping

  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Code:
    while(!file.eof())

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. EOF Explanation Anybody?
    By blackcell in forum C Programming
    Replies: 1
    Last Post: 01-29-2008, 08:09 PM
  2. EOF or not EOF?
    By CornedBee in forum Linux Programming
    Replies: 2
    Last Post: 09-14-2007, 02:25 PM
  3. EOF messing up my input stream?
    By Decrypt in forum C++ Programming
    Replies: 4
    Last Post: 09-30-2005, 03:00 PM
  4. whats the deal with EOF really ???
    By gemini_shooter in forum C Programming
    Replies: 7
    Last Post: 03-06-2005, 03:04 PM
  5. files won't stop being read!!!
    By jverkoey in forum C++ Programming
    Replies: 15
    Last Post: 04-10-2003, 05:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21