Newsgroups: comp.sys.atari.st
Path: utzoo!lsuc!jimomura
From: jimomura@lsuc.on.ca (Jim Omura)
Subject: Re: 3 bombs
Organization: Consultant, Toronto
Date: Thu, 9 May 1991 22:25:40 GMT
Message-ID: <1991May9.222540.13265@lsuc.on.ca>
References: <1991May7.231318.12305@lsuc.on.ca>

In article <1991May7.231318.12305@lsuc.on.ca> jimomura@lsuc.on.ca (Jim Omura) writes:
>
>     I've been working on a program for a few months now and it's got
>one "last" problem that I can't fix.  I've been staring at it off and
>on for months now.  The program is graphics oriented using GEM calls.
>As far as I know I've done everything I need to do for a "clean exit"
>back to the desktop.  But I still get 3 bombs when it returns to
>the desktop.  Functionally the program is usable as-is.  But I don't
>like the idea of marketting a product that bombs on exit.  I've
>compiled the program with Sozobon C and I was wonder if this is a
>specific problem with Sozobon.  Or is there something I don't know
>about exiting from GEM?

     I found the answer yesterday!  Many thanks to all who responded.
In fact, though nobody identified the problem exactly, the tip off
was when someone recommended that I try compiling my "initialization"
and "clean exit" sequences separately to make sure the problem was
in that area.  In fact, it made me think a bit more about my code
structure.  Almost all my testing included saving a file before
exiting.  Since the file saved properly, I assumed that that code
was correct.  But it occurred to me that at the end of the routine
I usually 'fflush()' the buffer at the end before returning.  In
fact, I was wondering if I forgot to put it in the code.  Well, it
was there alright, but the problem was that it should NOT have
been there this time.  'fflush()' is only used when you have a
path that's been 'fopen()'d and is pointed to with a type FILE.
The path I was using had been openned by 'open()' and the pointer
was a type 'int'.  The surprising thing is that I didn't seem to
have any crash problems when I ran my program from a text Shell.
Oh well.  It's party time! :-)


-- 
Jim Omura, 2A King George's Drive, Toronto, (416) 652-3880
lsuc!jimomura
Byte Information eXchange: jimomura
