Writing a program, need some help.

This is a discussion on Writing a program, need some help. within the C Programming forums, part of the General Programming Boards category; I am trying to write a program to read an arbitrary, but fixed number of input records from a file. ...

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    16

    Writing a program, need some help.

    I am trying to write a program to read an arbitrary, but fixed number of input records from a file. I then want it to put or print this information read into another file. How would I go about doing this?

    Say for example I have a file called input.dat and I want it to read the info. from that file and then put it into another file called output.dat.

    Thanks.

  2. #2
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    Well, you open the file, read it in the format that it is in, print it out. Don't be so general if you need specific help. Do you need how to work with files?
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    16
    I know how to open the files I want the info. to be read from and then printed to. I think I get also, how to print the info from the source file ("r") into the destination file ("w").

    Now, once I get the info into the destination file, how do I go about doing a sort to arrange the information as I want it. If the info I read into the destination file is a group of customers who have just rated a product, and I want it to sort the ratings by arithmetic mean, how would I do that?

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    How do you think you would do it? Work it out on paper, then try it. Doesn't anyone think around here any more?

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,812
    >Doesn't anyone think around here any more?
    I know I don't.

    but heres a hint compare them agianst what you want
    Woop?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a program to make a calendar
    By Northstar in forum C Programming
    Replies: 17
    Last Post: 11-07-2007, 11:34 AM
  2. writing a calendar program help please!!!
    By Newbie2006 in forum C Programming
    Replies: 7
    Last Post: 11-20-2002, 07:36 PM
  3. Replies: 5
    Last Post: 11-19-2002, 09:36 PM
  4. Help with a file writing program
    By pritesh in forum C Programming
    Replies: 3
    Last Post: 11-11-2001, 01:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21