file I/O

This is a discussion on file I/O within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by cmasri ms visual studio.net 2003 Tried with this compiler Code: #include <iostream> #include <string> #include <fstream> void ...

  1. #16
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    5,683
    Quote Originally Posted by cmasri
    ms visual studio.net 2003
    Tried with this compiler
    Code:
    #include <iostream>
    #include <string>
    #include <fstream>
    
    void ListFileHDD(std::ifstream& fin)
    {
    	std::string line;
    	while (!fin.eof())
    	{
    		std::getline(fin,line);
    	}
    	std::cout<<line;
    }
    
    int main(void)
    {
    	std::ifstream fin("c:\\test");
    	ListFileHDD(fin);
    	return 0;
    }
    have no errors at all. Are you sure you include everything is needed?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  2. #17
    Registered User
    Join Date
    Jan 2005
    Posts
    7,319
    I put this in the other thread, but those errors always occur in VC++ 2003 if you forget the #include <string>.

  3. #18
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,681
    Just for grins, what extension is your source file (.C or .CPP etc...) not that that's an issue here.
    I used to be an adventurer like you... then I took an arrow to the knee.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  3. 2 questions surrounding an I/O file
    By Guti14 in forum C Programming
    Replies: 2
    Last Post: 08-30-2004, 11:21 PM
  4. File I/O problems!!! Help!!!
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 05-17-2002, 08:09 PM
  5. advice on file i/o
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-29-2001, 04:56 AM

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