Thread: Need help on outputing.....

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User Cpro's Avatar
    Join Date
    Oct 2006
    Posts
    149
    Code:
    ...
    input>>word;
    cout<<word<<endl;
    input.clear();
    input.close();
    input.open("meaning.txt");
    ...
    Try adding input.clear(); This should fix the problem. This kind of explains it, although, I don't fully understand it myself. I thought when you closed the file everything reset. Perhaps someone else could explain.

    Edit- It's probably better to put the input.clear() after you close the file.
    Last edited by Cpro; 04-16-2009 at 08:56 AM.
    IDE - Visual Studio 2005
    Windows XP Pro

  2. #2
    Registered User
    Join Date
    May 2007
    Posts
    67
    Oh, thank you Cpro. I just tried but it still never output the meaning-----I mean the sentence. SO I am just wondering whether I can output a sentence by getline or just do somethng else, like read in the sentence as a string.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help in outputing different file names in a loop
    By nightfallz in forum C++ Programming
    Replies: 3
    Last Post: 02-16-2009, 10:53 AM
  2. Outputing an array to a textbox ?
    By C of Green in forum C# Programming
    Replies: 2
    Last Post: 10-31-2006, 11:28 AM
  3. Outputing Results to a File
    By SITHDUKE in forum C++ Programming
    Replies: 11
    Last Post: 03-03-2005, 07:33 PM
  4. Help with outputing char in int
    By xephyr in forum C++ Programming
    Replies: 4
    Last Post: 08-28-2004, 11:18 PM
  5. Replies: 2
    Last Post: 01-02-2002, 02:05 PM