4- Fields operations
In the current version, 4 types of fields are supported :
- CPDB_TYPESHORTINT : Short Integer, 1 octet, from -128 to 127
- CPDB_TYPEINT : Integer, 2 octets, from -32768 to 32767
- CPDB_TYPELONGINT : long integer, 4 octets, from -2147483648 to 2147483647
- CPDB_TYPESTRING : a string, ascii zero terminated
Use the following example :
Err err; MemHandle handle; Char *string;
err = CPDB_ReadString(mydbHandle, "FIELDNAME", &handle); if (err == 0) { string = MemHandleLock(handle); // Use the string now // ... // Free the string MemHandleUnlock(handle); MemHandleFree(handle); } |
Important : the CPDB_ReadString function allocate the memory for you, so you must free this memory after use.
Use the following example :
Int8 int8;
err = CPDB_ReadShortInt(hOREST, "FIELDNAME", &int8);
Int16 int16;
err = CPDB_ReadInt(hOREST, "FIELDNAME", &int16);
Int32 int32;
err = CPDB_ReadLongInt(hOREST, "FIELDNAME", &int32);
CPDB_ReadShortInt
CPDB_ReadInt
CPDB_ReadLongInt
CPDB_ReadString
Creation date : 01/10/2003 @ 06:33
Last update : 01/10/2003 @ 07:27
Category : CPDB library
Page read 10544 times
Top
Site running with GuppY v3.1 - GNU Public License - © 2002-2024
Page loaded in 0.03 second