Results 1 to 4 of 4

Thread: Appending a file

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    PHP Code:
    ofstream fout("file.txt"ios::app); //for append
    fout<<"some text";
    fout.close(); 
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Thank yew
    Alcohol & calculus don't mix.
    Never drink & derive.

  3. #3
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Post How?

    I think I put the code in a wrong spot... It just like a LOOP in VB. I get like 10 copies of the text every time I click the button, and yes it appends... But where do you put the:
    Code:
    ofstream OP("test.txt",ios::app);
    ...

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  4. #4
    Megatron
    Guest
    Try:
    Code:
    ofstream OP("test.txt", ios::app);
    
    for(int i=0; i<10; i++)
    	OP << "My Text"
    
    OP.close();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width