aboutsummaryrefslogtreecommitdiffstats
path: root/tempfile.h
blob: cf0a0544f649e760bd7dd49752851bb1efebb2ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef TEMPFILE_H
#define TEMPFILE_H

#include "compiler.h"

enum temp_file_mode {
    TF_BINARY,			/* Raw binary */
    TF_TEXT,			/* Text mode compatible with ASCII */
    TF_UNICODE			/* Platform preferred Unicode encoding */
};

struct temp_file {
    FILE *f;
    size_t namelen;
    int fd;
    enum temp_file_mode mode;
    char filename[1];
};

extern struct temp_file *temp_file(enum temp_file_mode mode);
extern int close_temp(struct temp_file **temp);

#endif /* TEMPFILE_H */