TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jonathan De Boyne Pollar
from: Russell Coker
date: 1994-08-22 20:23:04
subject: Debugging Pm Programs

NS>
  > how would I redirect the printf?  I've done fprintf(stderr,
  > "blah) in the past...  but sometimes my program would crash
  > and there would be nothing in the file.  I wonder... no. I
  > bet it's the Lazywrite feature of the file cache.  What do
  > you think?
NS>

JP>  Nope.  It's the line buffering done by the standard library.  Either
JP>  use setvbuf() to remove all buffering on stdout/stderr, or explicitly
JP>  fflush() after every fprintf.

  Of course another solution is to use DosWrite(1,...).  If a write to a
file handle via DosWrite has returned then NOTHING should be able to
prevent it from eventually appearing on the output device.  This also saves
the overhead of the STDIO library.  Also (for me at least) most debugging
output is plain text and doesn't need any %d modifiers etc that printf()
provides.


  cya
___
 X MR/2 2.0 NR X If it walks out of your refrigerator, LET IT GO !!

--- Maximus/2 2.01wb

* Origin: Multi - 61-3-739-7145 (3:633/363)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/301 341 348 365 386 998 633/104 252
SEEN-BY: 633/260 357 363 371 373 379 634/384 635/210 502 503 636/100 638/100
SEEN-BY: 640/820 690/660 711/409 410 413 430 807 808 809 934 712/353 623
SEEN-BY: 713/888 800/1
@PATH: 633/363 260 371 635/503 632/348 711/409 54/54 711/808 809 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™.