TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Henk Den Adel
from: Bill Christensen
date: 1997-01-29 12:32:00
subject: redirection

FT> HdA> appli  log
FT>  HdA> leaves me with a file of 0 length, whereas without redirection:
FT>  HdA> appli < input
FT>  HdA> results are written to the screen.
FT>  HdA> When i open a stream and write my intermediate info to this stream,
FT>  HdA> the streamed file is empty as well, as a result of the trapping.
FT>  HdA> So how can i redirect my info (printf) to a file, when the program tr
FT> 
FT> try (f)pritf(stderr), look up atexit() if on your compiler
FT> 
FT>  HdA> I am using OS/2 version 2.1. IBMs C compiler (2.01) or Borlands C
FT>  HdA> compiler (1.0) produce the same redirection behaviour, so it must be 
FT>  HdA> intrinsic feature of the OS.
FT>  HdA> Any idea to solve this dilemma?
FT> 
FT> appli  log. or appli log
FT> might do it, or a variation thereof. I had to use it once or twice
FT> with some  applications that didn't want a redirection either, and
FT> that forced it. Don't  remember where I got the info from, but
FT> somebody in this area is bound to know  and fill in my (huge) gaps

I would say " appli  log " would get the data
that is slated
to go to your screen to be sent to the "log" file.  Instead of using
printf which sends data to stdout (which "appli" probably wants as the
screen) use fprintf (stderr,.....) which sends your debugging
statements to the "log" file.  In order to get info into your
"log"
file when OS2 is about to shut down your "appli", setup and use the
SIGNAL functions.  When OS2 is about to shutdown your "appli" it will
call one of appli's signal functions which will allow ONE function to
run (the function could have a statement like fprintf(stderr,"some
information" to your log file)) before shutting  down
"appli".     TTFN
Bill
 Internet address wchriste{at}eagle.wbm.ca

---
 þ KWQ/2 1.2i þ Windoze is to Productivity as Pancakes are to a BBQ Grill.

--- Shotgun v2.00
* Origin: GUNN Data Systems - Saskatoon,SK - (306)652-0288 (1:140/146)
SEEN-BY: 50/99 54/99 270/101 620/243 625/160 711/401 413 430 934 712/311 407
SEEN-BY: 712/505 506 517 623 624 704 713/317 800/1
@PATH: 140/146 1 3 396/1 270/101 712/624 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.