[comp.sys.mac.programmer] FFlush problem in LSC Debugger

jlee4@orchid.waterloo.edu (jlee4) (06/15/89)

Hi people.  I just got my 4 Megs of RAM, so I started hacking
away on nethack. When suddenly, the LSC Debugger started barfing
(i.e. Bus Error) when fflush(stdout) was invoked.  This was the
first time it happened (i had used the Debugger before on the
same project 3 months ago with no problems) and now it won't stop.

Symptoms: Only happens in LSC Debugger, if in Finder, or
executing from within app (not Run command) or with
Use Debugger turned off in MultiFinder, it works fine.

System:	Mac II, 5MB, 40MB HD
	LSC and LSC Debugger partitions are set to 700K and 200K
         respectively. Project is set to 700K, use STRS,
	no multifinder flags set, MacsBug symbols only.

Looking at the source for fflush (in std_filepos.c) it seems as if
it doesn't check to see if the file is a Stdio file and gets
trashed when it calls GetVRefNum. When it does work it seemd, to
call the HFS routines, GetVRefNum and PBFlshVol even on stdout!

Should I just add in the patch to check for Stdio files, or what
am I doing wrong.

Johnny Lee
jlee4@orchid.waterloo.edu
watmath!orchid!jlee4

siegel@endor.harvard.edu (Rich Siegel) (06/16/89)

In article <113@orchid.waterloo.edu> jlee4@orchid.waterloo.edu () writes:
>
>Hi people.  I just got my 4 Megs of RAM, so I started hacking
>away on nethack. When suddenly, the LSC Debugger started barfing
>(i.e. Bus Error) when fflush(stdout) was invoked.  This was the

	This isa known problem in stdio, and will be fixed in the
next release of the libraries. If you want to fix it yourself now,
check that the stream getting flushed is not a standard stream.

	The woraround is to not call fflush for stdin, stdout, or
any other stream that might originate in a window. (use this
approach if you don't want to muck with the libraries.)

		--Rich





~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

 I classify myself as a real developer because my desk is hip-deep in
 assembly-language listings and I spend more than 50% of my time in TMON.

~~~~~~~~~~~~~~~