Re: need help




"gman" <ganeesh@xxxxxxxxx> wrote in message
news:1140018145.864528.253840@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hi group
i am trying to write a c program to get a file name from the
user and read that file and copy all the contents into a new file using
only unbuffered i/o in the following manner
input file
Once upon a time

In a far away land
There lived a ...

output file
There lived a ...
In a far away land

Once upon a time

Please help me i am getting frustrated with this
Ganesh


What have you tried so far? Why does it have to be unbuffered, other than
that is what the homework assignment says to do?

Start by accepting the file names (from stdin, or as command line
arguments).
Open the two files, one in read mode, the other in write mode. Be sure to
check for success.
If the input file is reasonably short, just read each line into an array of
strings, then write the strings to the output file in reverse order.
Then close the files.
If the file is very long, you might need to try something else (it might not
fit entirely in memory).

--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project


.



Relevant Pages

  • Beginner needs help with text files
    ... I did this very easily in a batch file, ... compressed so I get garbage characters in the output file which I can't ... The text lines (strings) in the files I am looking for would be something ...
    (microsoft.public.vb.general.discussion)
  • Re: Beginner needs help with text files
    ... > I did this very easily in a batch file, ... > compressed so I get garbage characters in the output file which I can't ... > The text lines (strings) in the files I am looking for would be something ...
    (microsoft.public.vb.general.discussion)
  • Re: how to read from more than one files at a time
    ... > operation on the strings and join them together, ... > one output file. ... Some symmetry between the ... handling of the two files would also be nice. ...
    (perl.beginners)
  • Re: need some help
    ... that takes two strings as arguments and returns ... char *ashstrstr ... the student to write the internals of strstr. ... Boeing Associate Technical Fellow ...
    (comp.lang.c)
  • Re: learning through osmosis
    ... catch the panties. ... If they land on your strings you ... get this weird muted effect. ...
    (alt.guitar.beginner)