Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Why this behavior? Date: Sat, 28 Mar 2015 17:34:56 -0700 Organization: None to speak of Lines: 27 Message-ID: <877fu0myj3.fsf@kst-u.example.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="c77ff4d35e33d1c939d3461ebde8dd0d"; logging-data="32232"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+dmU5sV+u+eLrW8fxthqf" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:yUMYsBvgnRffh9ce7YZ/8InUA2M= sha1:5oRcQ05wsiUemQv79bp/YCGdk20= Xref: csiph.com comp.lang.c:59183 bilsch writes: >> However there's a freopen() command that you can use to redirect stdin >> stdout and stderr. So commonly when programs are being debugged, and the >> developer wants to scatter printf() and scanfs(), the streams are >> attached to an interactive prompt, which often pops up in its own >> window. >> If you do a web search on your operating system and "redirecting stdout >> / stdin" you'll find out how to do this. > > I searched as you suggested and read a lot I don't understand - and > nothing specific to anything I do understand. Apparently I need to use > this freopen() command in my program and somehow get an interactive > window to pop up that will show the text output by the printf() commands > and accept input to the scanf() commands which are in my program. The > program needs to get Ubuntu to provide this interactive window or does > the code have to create the interactive window? If you're on Ubuntu, just run the program from a shell prompt. Its stdin, stdout, and stderr will be inherited from the shell: stdin will read from the keyboard, and stdout and stderr will write to the terminal (emulator). -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"