Pointing !

This is a discussion on Pointing ! within the C++ Programming forums, part of the General Programming Boards category; Im doing this calulator app and I have a little problem with the parser.. the main function is calling the ...

  1. #1
    Burning in Hell! Luigi's Avatar
    Join Date
    Nov 2002
    Posts
    117

    Pointing !

    Im doing this calulator app and I have a little problem with the parser..

    the main function is calling the parser for each char entered..

    when I was using cin.get(ch) everything was going perfectly...

    But Now im trying to use istringstream instead.
    But it keeps pointing at the same char?

    why cin.getr will go to next char but ist.get(ch) wont?

    Here is the stream that I use:

    istringstream ist(temp_string);
    ist.get(ch)

    Or d/l the full code :
    Attached Files Attached Files
    Last edited by Luigi; 04-07-2003 at 10:39 PM.
    Luigi


    // I use Xcode 1.1 && CodeWarrior 8.3
    // When on Mac Os X 10.3.2

    // I use Microsoft Visual C++ 6.0
    // When on windows XP

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,648
    This worked corretly for me:
    Code:
    istringstream ist("Whats up dog!");
    char ch;
    while (ist.get(ch))
        cout << ch;
    gg

  3. #3
    Burning in Hell! Luigi's Avatar
    Join Date
    Nov 2002
    Posts
    117
    yeah that will work but since I call the function from main for each char it seems to forget where it was pointing at last time which didnt happen when I was using cin.get(ch)
    Last edited by Luigi; 04-07-2003 at 10:36 PM.
    Luigi


    // I use Xcode 1.1 && CodeWarrior 8.3
    // When on Mac Os X 10.3.2

    // I use Microsoft Visual C++ 6.0
    // When on windows XP

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,648
    The first question we ask in a code review is "Does your code compile?" It doesn't for me - the code you posted anyways.

    gg

  5. #5
    Burning in Hell! Luigi's Avatar
    Join Date
    Nov 2002
    Posts
    117
    sorry was doing some test when I posted it and forgot some in it now its all right if u d/l again
    Or just remove * before ist..

    istringstream *ist(temp_string); // Oops!!

    BTW: try to forget all the cout included... I used them for debugging..
    I changed the attachement to remove them..

    Luigi //sorry!
    Last edited by Luigi; 04-07-2003 at 10:40 PM.
    Luigi


    // I use Xcode 1.1 && CodeWarrior 8.3
    // When on Mac Os X 10.3.2

    // I use Microsoft Visual C++ 6.0
    // When on windows XP

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointing to arbitrary location
    By elmutt in forum C Programming
    Replies: 2
    Last Post: 02-28-2008, 05:30 AM
  2. Objects pointing to each other
    By ldb88 in forum C++ Programming
    Replies: 3
    Last Post: 05-18-2007, 08:18 PM
  3. Pointing to struture members.....
    By kas2002 in forum C++ Programming
    Replies: 7
    Last Post: 08-13-2006, 10:07 AM
  4. Pointing a function pointer to a variable?
    By Aidman in forum C++ Programming
    Replies: 9
    Last Post: 07-06-2003, 10:50 PM
  5. DC is not pointing to my window!
    By frenchfry164 in forum Windows Programming
    Replies: 3
    Last Post: 02-18-2003, 07:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21