Thread: Adding to a file

  1. #1

    Adding to a file

    Hey, i need some help. i am currently writing to a file (using outfile) but i want to know whether you can open the file (using infile) before you send it to the outfile.
    Thank you for your help.

  2. #2

    Can fix it in one

    mmmmm sounds like a simular problem im having, heres the email to a guy i know who might be able to help

    Dave.Rees he teaches c++ in swansea

    catch you later

  3. #3
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Not sure I quite understand. If you have a file, you can read from it, and then write to it later, if you want. If you want to add on to the end of the file, you can use the ios_base::app flag when opening it:

    fstream file;"file.txt", ios_base::app);
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  4. #4
    Registered User
    Join Date
    Mar 2002
    Files can come from anywhere. You can write them yourself using a text editor. They may contain data written from another program. They may contain data written from the current program. But whereever the data came from, if it is in the correct format, you can load it into your program where you can use the data in some fashion. You can then leave the data in the file unchanged, or change the data stored in the file by writing data from your program back to the file.

    While the data is in your program it is held in a container of some sort. Containers can range in complexity from a primitive variable like an int, char or array or more complicated like a list or an instance of a user defined class or an instance of even be a more sophisticated container like a queue or a multimap or whatever.

    The data held in the containers within your program doesn't have to come from files, either. It could be hard coded, input by a user, or be derived from a function within the current or other active program. However you obtain data for the containers in your program, what you do with the data within your program and how you handle the data after the after you are done with it is up to you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  4. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM