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 #102 background imageLoading...
Page #102 background image
Buffer Ownership
CPStrings control and manage a PEGCHAR* buffer that represents a string. The
deletion of these buffers is normally handled by the CPString class. If you have a
PEGCHAR* that you have already created, but would like to encapsulate in a CPString
class, you can place it in a CPString with:
void TakeBufferOwnership(PEGCHAR *buffer);
This does not mean that the PEGCHAR buffer is copied into CPString. Instead, the
current memory location of PEGCHAR becomes the buffer portion of the CPString. The
CPString’s current buffer is discarded when it takes ownership of the new buffer.
On the other hand, you can give up the ownership of a buffer and place it back into a
PEGCHAR* with:
PEGCHAR *GiveBufferOwnership();
This function differs from GetBuffer() in a very important way: Once a CPString has
called GiveBufferOwnership() its buffer is gone. The person who called the function is
now responsible for keeping track of the returned PEGCHAR* and making sure that it is
deleted.
String Conversions
The ClassPad contains several functions to convert strings to and from different data
types. Be aware that these functions take CP_CHAR* and not CPStrings. However,
once you have the converted value you can easily create a CPString with the appropriate
constructor.
Converting Between CPStrings and Supported C native data types
To convert a string to another data type the following functions are used:
int CP_StringToInt(CP_CHAR *pS);
long CP_StringToLong(CP_CHAR *pS);
short CP_StringToShort(CP_CHAR *pS);
char CP_StringToChar(CP_CHAR *pS);
If you want to convert from an int, long, short or char to a string, use:
CP_CHAR *CP_IntToString(int value, CP_CHAR *pS);
CP_CHAR *CP_LongToString(long value, CP_CHAR *pS);
CP_CHAR *CP_ShortToString(short value, CP_CHAR *pS);
CP_CHAR *CP_CharToString(char value, CP_CHAR *pS);
102

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