delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/29/11:19:31

From: "Ian Pitt" <IanPitt AT worldnet DOT att DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: printf() and shl Questions
Date: 29 Jun 1997 02:40:01 GMT
Organization: AT&T WorldNet Services
Lines: 67
Message-ID: <01bc8436$29d72fc0$0bc074cf@ian>
References: <33B59082 DOT F71 AT sandiegoca DOT ncr DOT com>
Reply-To: "Ian Pitt" <Ian_Pitt AT bigfoot DOT com>
NNTP-Posting-Host: 207.116.192.11
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is a multi-part message in MIME format.

------=_NextPart_000_01BC8414.A2CEB780
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Actually the compiler isn't doing anything wrong.  You need to flush the
buffer after printing.  I think it is something like this
  printf("Hello world"); fflush(stdout);
  getch();



Justin Talbot <stevetalbot AT sandiegoca DOT ncr DOT com> wrote in article
<33B59082 DOT F71 AT sandiegoca DOT ncr DOT com>...
> Two problems:
> 
> First if I compile and run a simple program:
> void main(void)
> {
> 	printf("Hello world");
> 	getch();
> }
> The computer waits for me to press a key, then prints "Hello world",
> then ends.  The compiler esentially switches the two function calls. 
> This also happens if I place two getch()s after the printf() statement,
> except it waits for two key presses before printing "Hello world."
> 
> Am I doing something very wrong? Is this a known problem with the
> compiler? Or is this something wrong with my copy?
> 
> Second, is there a way to use the Intel ASM command 'shl eax,16' in AT&T
> syntax?
> 
> Any help would be appreciated.
> 
> Justin Talbot
> 
------=_NextPart_000_01BC8414.A2CEB780
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<html><head></head><BODY bgcolor=3D"#C8E0D8"><p><font size=3D2 =
color=3D"#000000" face=3D"Arial">Actually the compiler isn't doing =
anything wrong. &nbsp;You need to flush the buffer after printing. =
&nbsp;I think it is something like this<br> &nbsp;printf(&quot;Hello =
world&quot;); fflush(stdout);<br> &nbsp;getch();<br><br><br><br>Justin =
Talbot &lt;<font =
color=3D"#0000FF"><u>stevetalbot AT sandiegoca DOT ncr DOT com</u><font =
color=3D"#000000">&gt; wrote in article &lt;<font =
color=3D"#0000FF"><u>33B59082 DOT F71 AT sandiegoca DOT ncr DOT com</u><font =
color=3D"#000000">&gt;...<br>&gt; Two problems:<br>&gt; <br>&gt; First =
if I compile and run a simple program:<br>&gt; void main(void)<br>&gt; =
{<br>&gt; &#009;printf(&quot;Hello world&quot;);<br>&gt; =
&#009;getch();<br>&gt; }<br>&gt; The computer waits for me to press a =
key, then prints &quot;Hello world&quot;,<br>&gt; then ends. &nbsp;The =
compiler esentially switches the two function calls. <br>&gt; This also =
happens if I place two getch()s after the printf() statement,<br>&gt; =
except it waits for two key presses before printing &quot;Hello =
world.&quot;<br>&gt; <br>&gt; Am I doing something very wrong? Is this a =
known problem with the<br>&gt; compiler? Or is this something wrong with =
my copy?<br>&gt; <br>&gt; Second, is there a way to use the Intel ASM =
command 'shl eax,16' in AT&amp;T<br>&gt; syntax?<br>&gt; <br>&gt; Any =
help would be appreciated.<br>&gt; <br>&gt; Justin Talbot<br>&gt; </p>
</font></font></font></font></font></body></html>
------=_NextPart_000_01BC8414.A2CEB780--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019