FileStream Example Overview

The FileStream example demonstrates how to read/write a TInt32 variable and a simple class to/from a file stream.

This GUI based example uses CEmployee class to store necessary employee information.

The WriteInt32ToStreamL() method writes a TInt32 variable to a file stream.

The ReadInt32FromStreamL() method reads a TInt32 variable from a file stream.

The AppendInt32ToStreamL() method appends another TInt32 variable to an existing file stream.

The ReadAllTInt32FromStreamL() method reads all the existing TInt32 variables present in a file stream.

The WriteEmployeeToStreamL() method writes employee information to a file stream.

The ReadEmployeeFromStreamL() method reads employee information from file stream.

Download

Click on the following link to download the example: FileStream.zip

Click: browse to view the example code.

Class summary

RBuf, RFileWriteStream, RFileReadStream, TStreamPos.

Usage

Commands are given to the example through its menu option.

The menu option consists of:
  1. Write a Tint32

  2. Read a Tint32

  3. Append a Tint32

  4. Read all Tint32

  5. Write an employee

  6. Read an employee