Files
odwetalibc/examples/file/filedemo.c
T

22 lines
620 B
C

#include <odweta/file.h>
#include <stdio.h>
int main() {
printf("creating a file using 'fileInit(<filename>)' (returns a file_t*)\n");
file_t* f = fileInit("test.txt");
printf("printing the file contents\n\n");
filePrint(f);
printf("\nconvering the file contents into a string (char*)\n");
char* string = fileToString(f);
printf("\"%s\"\n", string);
// TODO -> writing, clearing
printf("if you are finished working with the file BEFORE the immediate end of the program, run 'fileCleanup(file_t*)', otherwise it is not strictly necessary\n");
fileCleanup(f);
return 0;
}