Thread: Saving probs...

  1. #1
    Inez
    Guest

    Saving probs...

    gah...alrite how do you make it just add on to a file? not completely rewrite it?

    exputput <<5;

    test.txt "5"

    output <<6;

    test .txt"6"

    howto test.txt"5 6"?

    next question...when saving a line ie"halo mr" howto get the comp to input 'halo mr' from test.txt?

    exp:

    char Yname[]("halo mr");
    output<<Yname;

    input>>Yname;

    cout <<Yname;
    "halo" not halo mr...howto get halo mr?


    sorry i haveta leave for work...already late...thas why not all is explained very well...i am proggin in MSVC in console~

    thanks in advance

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    1) ios::app
    2) input.getline()

    look them up
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    first:

    add ios_base::app to the open mode when opening the file.

    second:

    use read instead like this

    input.read(Yname,7);
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 11-04-2007, 12:55 PM
  2. Saving to a file!
    By MrMe913 in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 09:54 AM
  3. Saving Game data algorithm,perhaps?
    By Sentral in forum Game Programming
    Replies: 2
    Last Post: 08-25-2006, 06:14 PM
  4. Saving a Variable???
    By almo89 in forum C Programming
    Replies: 3
    Last Post: 02-15-2006, 08:22 PM
  5. File saving problem in DevC++ pls help ???
    By intruder in forum C Programming
    Replies: 3
    Last Post: 12-17-2002, 01:17 AM