-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_stream.h
61 lines (55 loc) · 1.76 KB
/
file_stream.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#ifdef HAVE_GZIP
#include <zlib.h>
#endif
#include "stream_base.h"
/**
* @struct file_stream
* @brief File stream structure for handling file-based streams.
*/
struct file_stream {
struct stream stream; /**< Base stream structure */
#ifdef HAVE_GZIP
union {
#endif
FILE *f;
#ifdef HAVE_GZIP
gzFile gz;
};
#endif
};
/**
* @brief Initialize a file stream.
* @param stream Pointer to the file stream object.
* @param filename Name of the file to open.
* @param mode Mode in which to open the file.
* @return Status code.
*/
int file_stream_init(struct file_stream *stream, const char *filename, const char *mode, int stream_flags);
#ifdef WIN32
/**
* @brief Initialize a file stream with wide-character filename.
* @param stream Pointer to the file stream object.
* @param filename Wide-character name of the file to open.
* @param mode Wide-character mode in which to open the file.
* @return Status code.
*/
int file_stream_initw(struct file_stream *stream, const wchar_t *filename, const wchar_t *mode, int stream_flags);
#endif
/**
* @brief Create a file stream.
* @param filename Name of the file to open.
* @param modeHere is the continuation and completion of the Doxygen comments for `stream.h`:
* @param mode Mode in which to open the file.
* @return Pointer to the created file stream object.
*/
struct stream *file_stream_new(const char *filename, const char *mode, int stream_flags);
#ifdef WIN32
/**
* @brief Create a file stream with wide-character filename.
* @param filename Wide-character name of the file to open.
* @param mode Wide-character mode in which to open the file.
* @return Pointer to the created file stream object.
*/
struct stream *file_stream_neww(const wchar_t *filename, const wchar_t *mode, int stream_flags);
#endif