Update read_entrie_file function
This commit is contained in:
parent
05e5a9ca21
commit
cb9b6fd4dc
@ -16,7 +16,7 @@ typedef struct {
|
|||||||
} dirwalk_result_t;
|
} dirwalk_result_t;
|
||||||
|
|
||||||
u64 get_file_length(FILE *fp);
|
u64 get_file_length(FILE *fp);
|
||||||
void read_entire_file(void *dst, u64 length, FILE *fp);
|
void read_entire_file(void *dst, FILE *fp);
|
||||||
dirwalk_result_t walk_dir(dirwalk_t **dirwalk, const char *filepath);
|
dirwalk_result_t walk_dir(dirwalk_t **dirwalk, const char *filepath);
|
||||||
|
|
||||||
#endif // !IO_H
|
#endif // !IO_H
|
||||||
|
4
src/io.c
4
src/io.c
@ -33,7 +33,9 @@ u64 get_file_length(FILE *fp) {
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_entire_file(void *dst, u64 length, FILE *fp) {
|
void read_entire_file(void *dst, FILE *fp) {
|
||||||
|
u64 length = get_file_length(fp);
|
||||||
|
|
||||||
u64 current = ftell(fp);
|
u64 current = ftell(fp);
|
||||||
|
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
Loading…
Reference in New Issue
Block a user