Thread: ifstream

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    43

    ifstream

    Hi all

    Hoping someone can help, I'm a little stuck trying to follow what is turning out to be a rather unhelpful book on programming direct 3d :S

    I have come across the line of code:

    Code:
    std::ifstream m_peopleFile (m_peopleFilename, std::ios::binary);
    presumably this is code used for reading information from m_peopleFilename, but I am coming up against the following error:

    m_peopleFile uses undefined class 'std::basic_ifstream<_Elem,_Traits>'

    I must admit I don't know much about using input and output streams for reading files at the moment, and have no idea how to proceed in resolving this. Can anyone help?

    Thanks :-)

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    It could be that your filename is a C++ string object, and not a C-string.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    If it's saying ifstream is undefined it's more likely that the fstream header has not been included.
    "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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple ifstream Question
    By Paul22000 in forum C++ Programming
    Replies: 8
    Last Post: 12-05-2008, 05:34 PM
  2. ifstream
    By Wraithan in forum Tech Board
    Replies: 3
    Last Post: 09-24-2006, 01:26 AM
  3. ios::in with ifstream? Why?
    By siavoshkc in forum C++ Programming
    Replies: 4
    Last Post: 01-30-2006, 10:26 AM
  4. ofstream and ifstream for searching and writing
    By johnnyd in forum C++ Programming
    Replies: 6
    Last Post: 03-17-2003, 08:34 AM
  5. Ifstream Problems
    By IlUomo in forum Windows Programming
    Replies: 1
    Last Post: 04-24-2002, 12:51 PM