News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Double posting with stdout.put

Started by gummipekk, August 10, 2010, 10:47:09 AM

Previous topic - Next topic

gummipekk

Hi forum,
I'm beginning my explorations of HLA using Hyde's book.
Getting aquainted with some of the basic control structures I'm getting double postings with stdout.put using this code snippet:

   repeat
      stdout.put("Is this OK? [y/n]", nl);
      stdin.get(svar);
   until(svar == 'y' || svar == 'n');

//Output:
//Is this OK? [y/n]
//Is this OK? [y/n]g
//Is this OK? [y/n]
//Is this OK? [y/n]e
//Is this OK? [y/n]
//Is this OK? [y/n]y
//(continiues code execution when entering 'y')




gummipekk

btw I'm on OSX 10.6.4, using HLA version 2.13 build 4166

Sevag.K

it's reading the enter as another character, try flushing the input after the stdin.get(svar).

stdin.flushInput();

this will clear pending characters in the input stream.

gummipekk

Ah, I see. Thanks so much for your help!