help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to select another stream that cin?


From: Leopold Palomo Avellaneda
Subject: How to select another stream that cin?
Date: Sat, 26 Apr 2003 12:59:06 +0200
User-agent: KMail/1.5.1

Hi,

I'm trying to do that flex read from another stream than cin, because I'm 
trying to do an interactive scan of strings.

In my class I have a:
istringstream *pstdin; // in the header
....
pstdin = new istringstream; // in the declaration
...

  
so I have some method that receive an string, in concrete a QString (Qt 
library)

An I do:

void myParser::set_stdin(QString line)
{
  pstdin->str(line.ascii()); //fill the stream with the contents of line, that 
// is a string
   valLexer.switch_streams(pstdin,0);
   //int ok = valLexer.LexerQString(line);
   parse();
}

if I do a trace of this, the lexer receive nothing, or not understand what 
receive. 
What I'm doing wrong? I'm trying to pass an string to the flex. I know that is 
not the "normal" behaviour, but I need that. Could someone help me, or point 
me some example of this?

Best regards,

Leo

-- 
Linux User 152692 
Catalonia





reply via email to

[Prev in Thread] Current Thread [Next in Thread]