VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
16.2 - 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 Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)