Creating files with variable suffixes at run time
Jeff Racine
racine at yunexus.yorku.ca
Wed Apr 17 00:20:45 AEST 1991
Hi.
I have a program which creates a data file. The user (at run time)
enters the number of variables. When the program runs, it generates a
data file which contains (in column form) the first variable, some
`stuff' for the first variable, the second variable, some stuff for
the second, and so on. Currently this is all dumped to one `mega'
file.
I would like to create separate files for each variable with names
like foo1.dat, foo2.dat, and so forth. The problem is that the number
of variables is variable, so I cannot hard code a number of files to
be open. The solution can open a file, write data, close the file,
open the next, write data, close the file etc. that is, the files do
not have to be open simultaneously. I hope this description is
sufficient.
Has anyone done this successfully? If so would you kindly outline your
solution? If not can someone see an easy way of doing this?
Thanks for your time and effort.
--------------------------------------------------------------------
Jeff Racine
racine at nexus.yorku.ca
racine at yunexus.UUCP
More information about the Comp.lang.c
mailing list