View Single Post
Old 09-19-2005, 11:29 AM   #3 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
You can use the same stream OBJECT as well. Just don't forget to close the object before loading a new file:
Code:
#include <iostream>
#include <fstream>

int main()
{
  std::ofstream fout("file_one.txt", std::ios::app);
  fout << "modified" << std::endl;
  
  //Close first!
  fout.close();
  
  fout.open("file_two.txt", std::ios::app);
  fout << "modified" << std::endl;
  return 0;
}
__________________
Valmont is offline   Reply With Quote