CringeDB/tests/File-Page Abstraction/1/filePageTest1.c
2024-02-18 17:42:05 +01:00

41 lines
766 B
C

#include "../../../File-Page Abstraction/cdb_file-page.h"
#include <stdio.h>
int main() {
fp_File file = fp_fileNew("created", 512);
if(file == NULL) {
printf("file is null\n");
return 1;
}
char * memory = fp_fileToMemory(file);
memory[0] = 'a';
memory[511] = 'b';
printf("Append pages\n");
memory = fp_fileAppendPages(file, 1);
if(memory == NULL) {
printf("memory is null\n");
return 1;
}
memory[1023] = 'z';
printf("Close\n");
fp_fileClose(file);
printf("Open\n");
file = fp_fileOpen("created");
if(file == NULL) {
printf("second file is null\n");
return 1;
}
printf("Init\n");
fp_fileInit(file, 512);
memory = fp_fileToMemory(file);
printf("%c%c%c\n", memory[0],memory[511],memory[1023]);
fp_fileClose(file);
return 0;
}