ifstream

This is a discussion on ifstream within the C++ Programming forums, part of the General Programming Boards category; Hi all Hoping someone can help, I'm a little stuck trying to follow what is turning out to be a ...

  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
    Katy, Texas
    Posts
    2,309
    It could be that your filename is a C++ string object, and not a C-string.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,803
    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, 04: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, 09:26 AM
  4. ofstream and ifstream for searching and writing
    By johnnyd in forum C++ Programming
    Replies: 6
    Last Post: 03-17-2003, 07:34 AM
  5. Ifstream Problems
    By IlUomo in forum Windows Programming
    Replies: 1
    Last Post: 04-24-2002, 12:51 PM

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