Thread: ofstream problems

  1. #1

    ofstream problems

    I am reading a variable through cin and i wish to output it to a file, my beta version works, but it kills the output after the first space...the tutorial here says to use the following code:
    string output;
    //use char or string??
    yada yada yada
    and yes i do have a main function and all that good stuff...i followed the example exactly, but during compile, i get this error:
    Could not find a match for 'istream::getline(string,char)' in function main()

    please help me, it would be much appreciated

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    std::string has its own global getline function, the version you're using works with char arrays. Try something like -


  3. #3

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. ofstream and ifstream for searching and writing
    By johnnyd in forum C++ Programming
    Replies: 6
    Last Post: 03-17-2003, 08:34 AM
  3. ifstream and fileIn problems
    By jobolikescake in forum C++ Programming
    Replies: 8
    Last Post: 10-26-2002, 03:00 PM
  4. Replies: 9
    Last Post: 06-06-2002, 07:03 PM
  5. Removing *Unchanged* Output File (ofstream) :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 01-05-2002, 07:47 PM