Thread: fstream input

  1. #1
    Registered User
    Join Date
    Oct 2001

    Question fstream input

    I named the file ,I wanted opened, a_file just like the example I found so I wouldnt confuse myself. I've tried compiling it and it says that getline is not a member of fstream. (I could have told it that )

    how can I get the following code changed so that I can read a line of text from a file and not get an error.


    thanks for any help.

  2. #2
    Registered User
    Join Date
    Aug 2001
    I assure you getline() is a member funciton of fstreams as frstreams are derived from ofstreams and ifstreams which in turn are derived from ostreams and istreams meaning fstreams have all the member functions of both output and input streams. The syntax you used should be fine if a_file is an fstream open for reading mode, or if a_file is an ifstream and units is a char array with at least 8 (9?) elements.

    Please post your exact code (or pertinent sections thereof) and the exact error message if you want to pursue this further.

  3. #3
    Registered User
    Join Date
    Oct 2001
    well thanks but I was talking with someone and I screwed up defining a_file. I cave the command to output to it instead of input. That should take care of my problem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. input redirection
    By sashaKap in forum C Programming
    Replies: 6
    Last Post: 06-25-2009, 01:59 AM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  4. fstream char array input question
    By mcdms in forum C++ Programming
    Replies: 6
    Last Post: 12-07-2004, 09:40 PM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 12:50 PM
Website Security Test