Thread: Reading variables through file output...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    11

    Reading variables through file output...

    I have been messign with C++ for about six months off and on, and i have started learning about file i/o i can write to and read from a file,
    How could i input int x=5;
    into a text file, to be called the next time it was needed (The next time the program ran)

    Thanks for the help

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Do you want to write the string "int x=5;" to a file? The integer value '5'? What? You can't store actual C++ commands in a file to be executed unless you want to write an interpreter.

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    11
    I want it to store what teh value of x was, so i t could be called later, is it possible to do that?

  4. #4
    Registered User
    Join Date
    Sep 2005
    Posts
    11
    never mind i saw another post with the same information.

  5. #5
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    lol thats prolly my buddies post, but like, yah, i've been working with the fstream for like a couple months now, and like, its still tough!

    we're currently building a single data file that is about 4500 lines of ones and zero's that are used in our program....

    got some serious arrays up in there

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. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. Need help fixing bugs in data parsing program
    By daluu in forum C Programming
    Replies: 8
    Last Post: 03-27-2003, 06:02 PM
  5. Reading a file to variables
    By BigBadApe in forum C++ Programming
    Replies: 2
    Last Post: 06-29-2002, 04:34 PM