Thread: Strange bug with Input stream

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    9

    Strange bug with Input stream

    Hi,

    Ive been stuck on this bug for a while now, Ive tried googling the answers etc but everything I try seems to fail:

    Code:
    string yytext;
    char ch;
    
                instream.get(ch);
                yytext += ch;                      // Puts character from stream on the end of the string
    
                while(isalnum(ch))              // loop while character is alpha-numeric
                {
                    instream.get(ch);            // needs to call the next character in the stream
                    yytext += ch;                  // add character to end of string
                }
    instream is streaming a text file into the program; this part of my function needs to stick alphanumeric characters together in to a word.

    Whats happening is the instream.get(ch); is just pulling the same character off the instream, and going into an infinite loop

    is there a nice simple call I can use to increment the steam position?
    Any suggestions would be awesome,

    thanks,

    Pete
    Last edited by Chazij; 11-18-2008 at 02:19 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Input class project (again)
    By Elysia in forum C++ Programming
    Replies: 41
    Last Post: 02-13-2009, 10:52 AM
  3. How to declare a global input stream
    By Chazij in forum C++ Programming
    Replies: 2
    Last Post: 11-18-2008, 04:53 PM
  4. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  5. clearing input stream
    By Sub in forum C++ Programming
    Replies: 2
    Last Post: 01-21-2002, 08:59 PM