#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
static char *btrieveFileName = (char *)"squaresAndSquareRoots.btr";
#define MIN_X 0
#define MAX_X 255
#pragma pack(1)
typedef struct {
uint8_t x;
uint16_t xSquared;
double xSquareRoot;
} record_t;
#pragma pack()
{
{
goto leave;
}
{
goto leave;
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
long long cursorPosition;
int i;
int recordCount;
record_t record;
for (i = MIN_X; i <= MAX_X; i++)
{
record.x = (uint8_t)i;
record.xSquared = (uint16_t)(i * i);
record.xSquareRoot = sqrt((double)i);
{
goto leave;
}
}
{
goto leave;
}
if ((recordCount = btrieveBulkCreateResult.
GetRecordCount()) != (MAX_X - MIN_X + 1))
{
goto leave;
}
for (i = 1; i <= recordCount; i++)
{
{
goto leave;
}
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
int i;
record_t record;
long long cursorPosition;
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
if (btrieveBulkRetrieveResult.
GetRecord(1, (
char *)&record,
sizeof(record)) !=
sizeof(record))
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
printf("record: (%u, %u, %g)\n", record.x, record.xSquared, record.xSquareRoot);
leave:
return status;
}
int
main(int argc, char *argv[])
{
static const char *usage = "Usage: %s uint8_value\n";
uint8_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 = (uint8_t)integerValue;
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
leave:
return 0;
return 1;
}
The Btrieve bulk create payload class.
Definition btrieveCpp.h:3807
Btrieve::StatusCode AddRecord(const char *record, int recordLength)
Add a record.
The Btrieve bulk create result class.
Definition btrieveCpp.h:3835
long long GetRecordCursorPosition(int recordNumber)
Get the record cursor position.
int GetRecordCount()
Get the record count.
Btrieve::StatusCode GetLastStatusCode()
Get the last status code.
The Btrieve bulk retrieve attributes class.
Definition btrieveCpp.h:3502
Btrieve::StatusCode AddFilter(BtrieveFilter *btrieveFilter)
Add a filter.
Btrieve::StatusCode AddField(int offset, int length)
Add a field.
Btrieve::StatusCode SetMaximumRecordCount(int maximumRecordCount)
Set the maximum record count.
Btrieve::StatusCode SetMaximumRejectCount(int maximumRejectCount)
Set the maximum reject count.
Btrieve::StatusCode SetSkipCurrentRecord(bool skipCurrentRecord)
Set skip current record.
The Btrieve bulk retrieve result class.
Definition btrieveCpp.h:3626
int GetRecordLength(int recordNumber)
Get the record length.
int GetRecordCount()
Get the record count.
int GetRecord(int recordNumber, char *record, int recordSize)
Get the record.
Btrieve::StatusCode GetLastStatusCode()
Get the last status code.
long long GetRecordCursorPosition(int recordNumber)
Get the record cursor position.
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 SetFixedRecordLength(int fixedRecordLength)
Set the fixed record length.
The Btrieve file class.
Definition btrieveCpp.h:1729
int RecordRetrieveFirst(Btrieve::Index index, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
Retrieve the first record.
Btrieve::StatusCode BulkRetrieveNext(BtrieveBulkRetrieveAttributes *bulkRetrieveAttributes, BtrieveBulkRetrieveResult *bulkRetrieveResult, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
Retrieve bulk next.
Btrieve::StatusCode BulkCreate(BtrieveBulkCreatePayload *btrieveBulkCreatePayload, BtrieveBulkCreateResult *btrieveBulkCreateResult)
Bulk create.
Btrieve::StatusCode GetLastStatusCode()
Get the last status code.
The Btrieve filter class.
Definition btrieveCpp.h:3392
Btrieve::StatusCode SetComparisonConstant(const char *constant, int constantLength)
Set the comparison constant.
Btrieve::StatusCode SetComparison(Btrieve::Comparison comparison)
Set the comparison.
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
@ OPEN_MODE_NORMAL
Normal.
Definition btrieveCpp.h:606
@ DATA_TYPE_UNSIGNED_BINARY
Unsigned binary.
Definition btrieveCpp.h:205
@ INDEX_NONE
None.
Definition btrieveCpp.h:553