-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileIO.h
More file actions
35 lines (27 loc) · 775 Bytes
/
FileIO.h
File metadata and controls
35 lines (27 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef LH_C_FILEIO_H
#define LH_C_FILEIO_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "types.h"
#define uint unsigned int
#define ulong unsigned long
#define uchar unsigned char
typedef struct {
ulong srcSize;
ulong destSize;
uchar *srcBuf;
uchar *destBuf;
uchar txtWidth;
uchar alignment;
} cData;
int load(const char *fname, cData * cData);
int save(const char *fname, const cData * cData);
int fText(const uchar * buf, ulong size, uint width, FILE * fp, const char *name);
static int FILE_SIZE(FILE* file) {
fseek(file, 0, SEEK_END);
int size = ftell(file);
fseek(file, 0, SEEK_SET);
return size;
}
#endif //LH_C_FILEIO_H