saving/reading information to/from a .txt using C++..

This is a discussion on saving/reading information to/from a .txt using C++.. within the C++ Programming forums, part of the General Programming Boards category; well i just started learning C++ and ive made a sort off text based (uses no graphcis on otherwards) game ...

  1. #1
    Unregistered
    Guest

    saving/reading information to/from a .txt using C++..

    well i just started learning C++ and ive made a sort off text based (uses no graphcis on otherwards) game but i dont know how to make a save and load option that would save things like username, level etc to a txt file, if you can hep then please do so or feal free to email me, thanks

    Email : jasonroller@aol.com

  2. #2
    Unregistered
    Guest
    there is a very good tutorial that explains file input and output yuo can check it an www.cpp-home.com at the rightside it says file i/o check it

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    106
    there is a very good tutorial that explains file input and output yuo can check it an www.cpp-home.com at the rightside it says file i/o check it
    C++ Makes you Feel Better

    "Gravity connot be held reponsible for people falling in love"--Albert Einstein

  4. #4
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Code:
     
    #include <fstream.h>
    
    int myvar;
    
    //To read
    ifstream fin("filename.txt")
    fin >> myvar;
    
    //...
    
    //To write
    ofstream fout("filename.txt")
    fout << myvar;
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 06-01-2009, 07:54 PM
  2. Assignment Help !! (Student information system)
    By ashb in forum C++ Programming
    Replies: 6
    Last Post: 03-12-2005, 04:32 AM
  3. Going out of scope
    By nickname_changed in forum C++ Programming
    Replies: 9
    Last Post: 10-12-2003, 06:27 PM
  4. Replies: 4
    Last Post: 03-31-2003, 11:49 PM
  5. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-20-2002, 11:35 PM

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