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
    6,484
    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,317
    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,799
    Just for grins, what extension is your source file (.C or .CPP etc...) not that that's an issue here.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

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