EasyManuals Logo
Home>Casio>Calculator>ClassPad 300

Casio ClassPad 300 Programming Guide

Casio ClassPad 300
125 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #123 background imageLoading...
Page #123 background image
The class only has two member functions, Read() and Write().
void Read(CPReadFile &f);
void Write(CPWriteFile &f);
Once you have created a CPMEMFileHeader, you simply call its Read() function if you
are reading in a file or its Write() function if you are writing out a file. For example,
here is the Read() function from AddressDocument.cpp:
// Application Type
const PEGCHAR* ADDRESSBOOK_MEMTYPE_HEADER = "AddressBook";
//Data Type
const PEGCHAR* ADDRESSBOOK_MEMTYPE_SAVED_STATE = "Data";
void AddressDocument::Read(CPReadFile &f)
{
if (f.FileExists())
{
//Create the file header with the application and data type
CPMEMFileHeader header(ADDRESSBOOK_MEMTYPE_HEADER,
ADDRESSBOOK_MEMTYPE_SAVED_STATE);
// Read in the header (basically reads the header and
// moves the file pointer to the start of the contact data)
header.Read(f);
if(f.IsNotError())
{
// Call the ContactArray’s Read Function
// (which in turn calls the Contact’s Read Function)
contacts.Read(f);
}
}
}
As you can see it is simply a matter of creating a header and then reading it in before
reading in the contacts in the file. Writing a file is done very similarly – before writing
the contacts a header is written to the file:
void AddressDocument::Write(CPWriteFile &f)
{
// Create the header
CPMEMFileHeader header(ADDRESSBOOK_MEMTYPE_HEADER,
ADDRESSBOOK_MEMTYPE_SAVED_STATE);
// Write the Header
header.Write(f);
if(f.IsNotError())
{
// Call the ContactArray’s Write function
contacts.Write(f);
123

Table of Contents

Other manuals for Casio ClassPad 300

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Casio ClassPad 300 and is the answer not in the manual?

Casio ClassPad 300 Specifications

General IconGeneral
BrandCasio
ModelClassPad 300
CategoryCalculator
LanguageEnglish

Related product manuals