From: "Ian Pitt" 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" NNTP-Posting-Host: 207.116.192.11 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01BC8414.A2CEB780" Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 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

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--