[comp.sys.mac.programmer] Help!! How to save a file???

cpyang@ccnysci.UUCP (Chao Ping Yang) (03/22/89)

Can someone tells me why the following sequence did not
save my output file?

...
fp = fopen(name,"w");
....
fclose(fp);
...

/* SYSTEM BOMB HERE or POWER OFF */
Using FSOpen, FSClose did not change
a thing. When the computer was on again,
my file was not there. Was it that I need
to update the desktop file myself?

Thanks for your help.


-- 
==Chaoping
cpyang@ccnysci.bitnet

dalea@fai.UUCP (Dale M. Arends) (03/24/89)

In article <1436@ccnysci.UUCP> cpyang@ccnysci.UUCP (Chao Ping Yang) writes:
>Can someone tells me why the following sequence did not save my output file?
>...
>fp = fopen(name,"w");
>....
>fclose(fp);
>...
>/* SYSTEM BOMB HERE or POWER OFF */
>Using FSOpen, FSClose did not change a thing. When the computer was on again,
>my file was not there. Was it that I need to update the desktop file myself?
>Thanks for your help.

If you have not done so, make sure you declare fp and fopen() as 
pointer.to.file references as follows:

FILE *fp, *fopen();

This can be done globally or within the subroutine that calls them.  If this
is not done, the stack will be munged due to incorrect number of bytes being
pushed and popped, which could easily lead to bombs.

Hope this helps.

Dale

-- 
		Dale M. Arends  (Fujitsu America Inc., San Jose, Calif.)
		dalea@fai.fai.com
		dalea@fai.UUCP
		{amdahl, pyramid, sun, unisoft, uunet}!fai!dalea

The opinions expressed herein do not necessarily reflect those of my employer.
They are entirely my own if they make sense and I disavow them if they don't.