initial commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#ifndef FILE_H
|
||||
#define FILE_H
|
||||
|
||||
#include <odweta/vector.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct {
|
||||
FILE* descriptor; // the file descriptor
|
||||
int length; // line count
|
||||
vector_t* lines; // 2d array of chars
|
||||
} file_t;
|
||||
|
||||
file_t* fileInit(char* path, char* mode); // initialization function
|
||||
// TODO: when there is not a '\n' at the end of a file, the last line is not loaded :(
|
||||
|
||||
void fileCleanup(file_t* f); // just to be memory safe...
|
||||
|
||||
int fileCountLines(file_t* f); //
|
||||
|
||||
void filePrint(file_t* f);
|
||||
|
||||
char* fileToString(file_t* f);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user