The MASM Forum Archive 2004 to 2012

Project Support Forums => HLA Forum => Topic started by: gummipekk on August 10, 2010, 10:47:09 AM

Title: Double posting with stdout.put
Post by: gummipekk on August 10, 2010, 10:47:09 AM
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')



Title: Re: Double posting with stdout.put
Post by: gummipekk on August 10, 2010, 12:14:20 PM
btw I'm on OSX 10.6.4, using HLA version 2.13 build 4166
Title: Re: Double posting with stdout.put
Post by: Sevag.K on August 10, 2010, 06:32:49 PM
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.
Title: Re: Double posting with stdout.put
Post by: gummipekk on August 10, 2010, 09:08:31 PM
Ah, I see. Thanks so much for your help!