I need a little input help.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: I need a little input help.

Threaded View

  1. #1
    Join Date
    Nov 2008
    Posts
    9

    I need a little input help.

    I'm writing a small program for a class I am working on and I have a bit of code that is not functioning correctly. I've tried debugging but it isn't helping much.

    The problem is in the function note1out(). The program completely skips over the getline command and doesn't wait for input from the user. As far as I can tell it should work fine but it doesn't. Can someone please analyze this little snippit and help me find out the problem. Let me know if you need more of the code.

    P.S. The compiler is Dev C++.

    int note1in()
    {
    system("cls");
    string a;

    ifstream note1 ("note1.txt");
    while (!note1.eof() )
    {
    getline (note1, a);
    cout << "The note reads: " << endl << a << endl << endl;
    }
    note1.close();

    system("pause");
    note1out();
    }

    int note1out()
    {
    string a;
    cout << "Begin re-writing the note... " << endl;
    getline (cin, a);
    _sleep(1500);
    ofstream note1 ("note1.txt");
    note1 << a;
    note1.close();
    cout << "The note has been saved..." << endl;
    _sleep(1500);
    Notes();
    }
    Last edited by Vipervenom9; April 4th, 2010 at 04:15 PM. Reason: Need code to be in code window.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center