delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/13/01:38:42

Message-Id: <199709130537.AAA10753@fly.HiWAAY.net>
Reply-To: <kwall AT utw DOT com>
From: "Kurt Wall" <kwall AT utw DOT com>
To: "Benjamin Audy" <baudy AT total DOT net>, <djgpp AT delorie DOT com>
Subject: Re: Redirection
Date: Sat, 13 Sep 1997 00:37:00 -0500
MIME-Version: 1.0

----------
> From: Benjamin Audy <baudy AT total DOT net>
> To: djgpp AT delorie DOT com
> Subject: Redirection
> Date: Friday, September 12, 1997 9:25 PM
> 
> Hi!
> 
> I don't think this is a problem for DJGPP specifically, but here it
> is:
> 
> In my program I use the "getchar" and "printf" functions. "getchar"

It would help to see some code, although I suspect you are getting user
input.

> returns a character from stdin (the keyboard in my case), which is

Actually, getchar() returns an int, not a char.

> also echoed to the screen (line buffered). But when I redirect the
> output at the command prompt (eg.: "program.exe > file.txt"), "printf"
> output is sent to the file, but "getchar" output is still sent to the
> screen. Why?

What do you mean by "'getchar' output"?  getchar() is an input function.
*putchar()* on the OTOH, is your ouput function...

Kurt

- Raw text -


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