This is an example of a key only file written in C++.
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
static char *btrieveFileName = (char *)"primes.btr";
#define MIN_X 1
#define MAX_X 255
{
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
uint32_t key;
int i;
int j;
uint32_t record;
for (i = MIN_X; i <= MAX_X; i++)
{
record = (uint32_t)i;
{
goto leave;
}
}
for (j = 2; j <= (MAX_X / 2); j++)
{
for (i = j * 2; i <= MAX_X; i += j)
{
key = (uint32_t)i;
{
continue;
}
{
goto leave;
}
}
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
retrieveRecord(
BtrieveFile *btrieveFile, uint32_t *key)
{
{
printf("%u is prime.\n", *key);
goto leave;
}
{
printf("%u is not prime.\n", *key);
goto leave;
}
leave:
return status;
}
int
main(int argc, char *argv[])
{
static const char *usage = "Usage: %s <uint8_value greater than zero>\n";
uint32_t key;
uint64_t integerValue;
if (argc != 2)
{
printf(usage, argv[0]);
goto leave;
}
integerValue = atoi(argv[1]);
if ((integerValue < MIN_X) || (integerValue > MAX_X))
{
printf(usage, argv[0]);
goto leave;
}
key = (uint32_t)integerValue;
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
leave:
return 0;
return 1;
}
The Btrieve client class.
Definition btrieveCpp.h:1388
Btrieve::StatusCode FileCreate(BtrieveFileAttributes *btrieveFileAttributes, const char *fileName, Btrieve::CreateMode createMode, Btrieve::LocationMode locationMode=Btrieve::LOCATION_MODE_NO_PREFERENCE)
Create a file.
Btrieve::StatusCode FileClose(BtrieveFile *btrieveFile)
Close a file.
Btrieve::StatusCode FileDelete(const char *fileName)
Delete a file.
Btrieve::StatusCode FileOpen(BtrieveFile *btrieveFile, const char *fileName, const char *ownerName, Btrieve::OpenMode openMode, Btrieve::LocationMode locationMode=Btrieve::LOCATION_MODE_NO_PREFERENCE)
Open a file.
The Btrieve file attributes class.
Definition btrieveCpp.h:2448
Btrieve::StatusCode SetKeyOnly(bool enableKeyOnly)
Set key only.
Btrieve::StatusCode SetFixedRecordLength(int fixedRecordLength)
Set the fixed record length.
The Btrieve file class.
Definition btrieveCpp.h:1729
Btrieve::StatusCode RecordCreate(char *record, int recordLength)
Create a record.
Btrieve::StatusCode RecordDelete()
Delete a record.
int RecordRetrieve(Btrieve::Comparison comparison, Btrieve::Index index, char *key, int keyLength, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
Retrieve a record using the given comparison, index, and key.
Btrieve::StatusCode KeyRetrieve(Btrieve::Comparison comparison, Btrieve::Index index, char *key, int keyLength)
Retrieve a key using the given comparison, index, and key.
The Btrieve index attributes class.
Definition btrieveCpp.h:3716
Btrieve::StatusCode AddKeySegment(BtrieveKeySegment *btrieveKeySegment)
Add a key segment.
The Btrieve key segment class.
Definition btrieveCpp.h:3874
Btrieve::StatusCode SetField(int offset, int length, Btrieve::DataType dataType)
Set the field.
@ COMPARISON_EQUAL
Equal.
Definition btrieveCpp.h:85
static const char * StatusCodeToString(StatusCode statusCode)
Return a status code as a string.
@ CREATE_MODE_OVERWRITE
Overwrite.
Definition btrieveCpp.h:72
StatusCode
The Btrieve status codes.
Definition btrieveCpp.h:713
@ STATUS_CODE_UNKNOWN
-7 - Unknown.
Definition btrieveCpp.h:1194
@ STATUS_CODE_NO_ERROR
0 - No error.
Definition btrieveCpp.h:715
@ STATUS_CODE_KEY_VALUE_NOT_FOUND
4 - Key value not found.
Definition btrieveCpp.h:723
@ OPEN_MODE_NORMAL
Normal.
Definition btrieveCpp.h:606
@ DATA_TYPE_UNSIGNED_BINARY
Unsigned binary.
Definition btrieveCpp.h:205
@ INDEX_1
Index 1.
Definition btrieveCpp.h:311