Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Ultrix file I/O using C
@ 1993-05-10 10:52 amal jasentuliyana
  0 siblings, 0 replies; only message in thread
From: amal jasentuliyana @ 1993-05-10 10:52 UTC (permalink / raw)


I'm having trouble writing files using C on a DEC machine running Ultrix.
The same code runs fine on a macintosh, so it has something to do with
Ultrix I/O.

In short, my program generates output ascii files of about 30-40K. The
program has a main loop that allows a user to vary parameters & generate
ouput files. As long as the program is user-driven, things work fine. Since
I dont want to sit around all night running the program, I wrote a routine
to vary the parameters automatically and call the main loop, changing the
output filename (and file pointer) each time. This works fine on the
macintosh. On the DEC however, although the output files are generated,
only the first file contains all the info it should. In successive files,
all entries after a two-line header are zeros!! The text of the headers is
fine.

I even tried piping an input file to the program that exactly mimics what
the user input would be for doing successive runs. Same problem.

My hunch is that it has something to do with timing. Successive files may
be being opened a few instructions after the pervious one was closed. Since
these are large files, if there is some sort of buffer that writes 'em to
disk, things may get screwy. All the same, why do the headers comeout fine?

When I step through the program using a debugger, the second output file to
be generated is fine at first. Howevever, once I let the program continue
to its end (ie at its own pace) the file gets changed to zeros!!

I'm using comands like fopen("file","w"), fprintf & fclose to generate the
files.

I will be very gratefull for any suggestions anyone has. Please use E-mail
for replies..

Thanks
amal.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-05-10 10:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-05-10 10:52 Ultrix file I/O using C amal jasentuliyana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox