Hey,<br><br> I am currently writing a parsing program in Perl that interacts with a C process. The C process initially forks() the Perl parser with STDOUT mapped to the parsers STDIN and the parsers STDOUT mapped to the C processes STDIN. <br><br>Because this forking and pipe setup is being done by the C process all my parser needs to worry about is reading from STDIN and writing to STDOUT. For testing purposes the STDOUT redirection hasn't yet been implemented and instead results go to the screen.<br><br>Currently I am having problems with reading STDIN, I get the message but unfortunately as soon as the parser has read it and printed the message to the screen (correctly) the parser keeps outputting newlines. This could be the logic in my parser, simplified it looks like:<br><br><FONT FACE=monospace><br>while ($data ne "#"
<br>{<br> $data = getc STDIN;<br> print "data is: $data";<br>}<br></font><br><br>which gives me (for an entered value of '12345'):<br><br><FONT FACE=monospace><i><br>data is:1<br>data is:2<br>data is:3<br>data is:4<br>data is:5<br>data is:<br>data is:<br>data is:<br>data is:<br></i></font><br><br>Which carries on till I interrupt the parser with a <b>^C</b>.<br><br>Is there some kind of flushing that I need to do, or should I try and capture <b>\n</b> to stop getc. Is it because there is nothing to read? <br><br>Any help appreciated.<br>Loon<br>