Thread: ios and istream, cin.getline(blah,blah,blah)

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    ios and istream, cin.getline(blah,blah,blah)

    Please help me...I am fairly new at C++ and perhaps am doing something wrong.

    I have created linked list using private member pointers. The purpose is to mimick a worksheet(like Excel). This allows the user to input values, peruse these values, etc.

    However, the key issue is input. Whenever I go outside of void main....oops, int main, cin.getline(blah,blah,blah) doesn't seem to work.

    Perhaps I am doing something wrong. However, if its not suppose to work outside of main...what should I do.

    I have tried using a friend function within my linking classes: istream &istream>>operator(istream&, object&) and istream &istream getline(istream &) w/o any success.

    cin and its overloaded operator >> works outside of main w/o any problems....but...as you are aware, it will only send back one stream in the stream object at one time.

    I have created this small looping program where I was able to retrieve the availabe chars after the first NULL of the input stream, but the only problem is, when you are trying to do error checkout(idiot proofing) if someone were to enter more than one space in the stream, the program will not work.

    Anyhow, any suggestions.

    Thanks

    007

  2. #2
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    Posts
    279
    it might have something to do with your namespace declaration

    but the best way to find the error would be if you would post some code either, along with your preprocessor directives....(all the includes)


    ....................
    matheo917

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    For text files, consider std::getline and std::string.

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. istream and ostream not declared?
    By aciarlillo in forum C++ Programming
    Replies: 4
    Last Post: 10-02-2005, 01:02 AM
  2. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  3. <list>
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 02-24-2002, 04:07 PM
  4. Multiple virtual inheritance
    By kitten in forum C++ Programming
    Replies: 3
    Last Post: 08-10-2001, 10:04 PM