home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!dcatlas!joet
- From: joet@dcatlas.dot.gov (Joe Trott)
- Subject: Re: How to fprintf two columns?
- Message-ID: <1992Aug28.153857.8234@dcatlas.dot.gov>
- Organization: U.S Dept. of Transportation
- References: <1684FBD10.KSZ@VM.NRC.CA>
- Date: Fri, 28 Aug 1992 15:38:57 GMT
- Lines: 22
-
- KSZ@VM.NRC.CA writes:
-
- >I need the following output to a file:
- > 1.2 2.3
- > 1.3 2.4
- > 1.4 2.5
- > ....
- >which contains two columns. They are not generated at the same time, i.e.
- >at the first the first column is generated and then write to a file. then
- >the file is rewinded and the second column is generated. Now I need write
- >the second column to that particular place, say begin with 10th column.
- >I have tried fseek() but it seems to me not working. (?)
- >
- >I have spent all day long and still don't see the light. Anybody can help me?
-
- If I were doing it (and I realize I'm not, so your method may differ), I
- would do it by making the first file a scratch file. Write the first column
- to it, rewind it, read it sequentially, write that value plus your second
- column value into the *real* output file, then delete the scratch file.
-
- -JTT
-
-