This example stores a given systolic and diastolic value in a Btrieve file.
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <ctime>
static char* btrieveFileName = (char*)"Pressures.btr";
#pragma pack(1)
typedef struct {
uint64_t timeTaken;
uint16_t systolic;
uint16_t diastolic;
char EvalCode;
} BPrecord_t;
#pragma pack()
{
{
goto leave;
}
{
{
goto leave;
}
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
{
goto leave;
}
{
}
{
goto leave;
}
{
goto leave;
}
leave:
return status;
}
insertRecord(
BtrieveFile* btrieveFile, uint16_t sysdata, uint16_t diasdata)
{
BPrecord_t record;
time_t now = time(0) * 1000000;
record.systolic = sysdata;
record.diastolic = diasdata;
record.EvalCode = 'N';
if ((sysdata >= 120 && sysdata < 130) && (diasdata < 80))
record.EvalCode = 'E';
if ((sysdata >= 130 && sysdata < 140) || (diasdata >= 80 && diasdata < 90))
record.EvalCode = 'H';
if ((sysdata >= 140 && sysdata <= 180) || (diasdata >= 90 && diasdata <= 120))
record.EvalCode = 'V';
if ((sysdata > 180) || (diasdata > 120))
record.EvalCode = 'C';
{
goto leave;
}
leave:
return status;
}
{
BPrecord_t record;
{
goto leave;
}
printf("record: (%u, %u, %c)\n", record.systolic, record.diastolic, record.EvalCode);
leave:
return status;
}
{
{
goto leave;
}
{
}
leave:
return status;
}
int
main(int argc, char* argv[])
{
uint8_t newFile;
uint16_t systolicInput;
uint16_t diastolicInput;
if (argc != 3)
{
printf("Usage: %s <systolic> <diastolic>\n", argv[0]);
goto leave;
}
systolicInput = atoi(argv[1]);
diastolicInput = atoi(argv[2]);
newFile = 1;
{
goto leave;
newFile = 0;
}
{
goto leave;
}
if (newFile == 1)
{
{
goto leave;
}
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
leave:
return 0;
return 1;
}