View Single Post
  #6 (permalink)  
Old April 10th, 2006, 08:45 AM
C@uark C@uark is offline
Authorized User
 
Join Date: Oct 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to C@uark
Default

my bad had brain fart when writing the mode

this is the format for .open function call,
your_fstream_object.open( const char* szName, int nMode, int nProt = filebuf::openprot );

You can also open a file by calling the constructor, to check out all the specifics of fstream goto www.msdn.com ; type fstream::fstream in the search

#include <fstream> //dont forget to #include header file
using namespace std;

int main () {

  fstream filestr;

  // open somefile with append mode and default protection
  // Note if file does not reside in same file as sorce code you must specify the full path and name
 filestr.open("somefile.txt", ios::app);

  // >> i/o operations here <<

  filestr.close();

  return 0;
}
Reply With Quote