Original collection
// AWZZZ @ 2002
// Getting Started -> Using (C Library) OFSTREAM Write Data
// Apo-> using OFStream.
// Accident Project of use OFStream. (C iostream library)
/ *
REFERENCE: http://www.cplusplus.com/ref/iostream/ofstream/
Description
Ofstream Class Provides a Street Interface to Write Data To Files.
THE CLASS MANTAINS INTERLY (Privately) a Pointer to a filebuf Object
In Charge of the Intertion with the file. This Pointer Can Be
Obtained / Modified by Calling Member Rdbuf.
The File to Be Processed Can Be Specified As a Parameter for T
Constructor or by calling member open.
After a file is processed it can be closed by calling member close.
In this case the file stream may be used to open another file.
MEMBER IS_OPEN CAN BE Used to Determine Wether The Stream Is Currently
Operating on a file or not.
Please refer to Parent Classes for more details on information mantained
By an OFStream Object.
* /
// Use (C ) OFSTREAM write file data
// Simple Example
#include
#include
Using namespace std;
#ifdef Win32
#define test_file "c: //tmp/test.txt"
#ELSE
#define test_file "/tmp/test.txt"
#ENDIF
Void test ()
{
// ofstream OFS;
//ofs.open; Test_File;
OFSTREAM OFS (TEST_FILE);
CHAR CH = '#';
Const char buf [] = "1234567890";
Ofs.put (ch); // simple
OFS.WRITE (BUF, SIZEOF (BUF));
Ofs.put (ch);
OFS.CLOSE ();
}
Int main (int Argc, char * argv [])
{
Test ();
Return 0;
}