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

36 lines
661 B
C

#include "../../../File-Page Abstraction/cdb_file-page.h"
#include <stdio.h>
int main() {
fp_File file = fp_fileTemp("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 0;
}else {
printf("second file was NOT null\n");
return 1;
}
}