VR-Forces 4.0.4 Class Documentation
Writing Data to a File

The putSelf() and putData() member functions write data to a file, as follows:

  1. Write an appropriate number of blanks based on indentLevel.
  2. Write an open parenthesis.
  3. Write the object name.
  4. Call the putData() member function. The putData() member function is responsible for writing the data value or values for the object.
  5. Tell the DtReaderWriter's registry (described later in this section) to put itself.
  6. Write a final closing parenthesis.

The putData() member function is specified as:

virtual void putData(FILE *fp, int indentLevel = 0);

The following example shows the putData() member function for the DtRwString (rwString.h) class, provided by VR-Forces.

void DtRwString::putData(FILE * fp, int)
{
   fprintf(fp, " \"%s\"", string());
}

[<< Readable, Writable Objects] [Home] [Top of Page] [Reading Data from a File >>]


Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)