Thread: What is ifstream& for?

  1. #1
    Registered User
    Join Date
    Oct 2010

    What is ifstream& for?

    I have a classes project and one function I need inside of the class is called check(ifstream&). I am suppose to read from a text file and then check it against a set of data that is already written in memory. That check(ifstream&) is for the inputting of the data from the text file but I am stump on what to do with the ifstream&. What parameter do I put in that when I call it in main?

    Please give me some insights on this. Thank you.

  2. #2
    Join Date
    Oct 2007
    Inside my computer
    Open a file using ifstream and pass it to the function.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    May 2011
    Around 8.3 light-minutes from the Sun
    You may gain some benefit from reading through Lesson 10:File Operations to brush up on how files work with C++. Additionally, the & in this case specifies that the object will be passed by reference to the function.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ifstream
    By Wraithan in forum Tech Board
    Replies: 3
    Last Post: 09-24-2006, 01:26 AM
  2. ios::in with ifstream? Why?
    By siavoshkc in forum C++ Programming
    Replies: 4
    Last Post: 01-30-2006, 10:26 AM
  3. Regarding ifstream...
    By alvifarooq in forum C++ Programming
    Replies: 7
    Last Post: 09-24-2004, 03:12 PM
  4. little help on ifstream
    By ssjnamek in forum C++ Programming
    Replies: 1
    Last Post: 04-15-2002, 12:10 PM