]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxFile}}\label{wxfile} | |
2 | ||
3 | A wxFile performs raw file I/O. Note that wxFile::Flush is not implemented on some Windows compilers | |
4 | due to a missing fsync function, which reduces the usefulness of this class. | |
5 | ||
6 | \wxheading{Derived from} | |
7 | ||
8 | None. | |
9 | ||
10 | \latexignore{\rtfignore{\wxheading{Members}}} | |
11 | ||
12 | \membersection{wxFile::wxFile}\label{wxfileconstr} | |
13 | ||
14 | \func{}{wxFile}{\void} | |
15 | ||
16 | Default constructor. | |
17 | ||
18 | \func{}{wxFile}{\param{const char*}{ filename}, \param{wxFile::OpenMode}{ mode = wxFile::read}} | |
19 | ||
20 | Opens a file with the given mode. | |
21 | ||
22 | \func{}{wxFile}{\param{int}{ fd}} | |
23 | ||
24 | Opens a file with the given file descriptor, which has already been opened. | |
25 | ||
26 | \wxheading{Parameters} | |
27 | ||
28 | \docparam{filename}{The filename.} | |
29 | ||
30 | \docparam{mode}{The mode in which to open the file. May be one of {\bf wxFile::read}, {\bf wxFile::write} and {\bf wxFile::read\_write}.} | |
31 | ||
32 | \docparam{fd}{An existing file descriptor.} | |
33 | ||
34 | \membersection{wxFile::\destruct{wxFile}} | |
35 | ||
36 | \func{}{\destruct{wxFile}}{\void} | |
37 | ||
38 | Destructor. This is not virtual, for efficiency. | |
39 | ||
40 | \membersection{wxFile::Attach}\label{wxfileattach} | |
41 | ||
42 | \func{void}{Attach}{\param{int}{ fd}} | |
43 | ||
44 | Attaches an existing file descriptor to the wxFile object. | |
45 | ||
46 | \membersection{wxFile::Close}\label{wxfileclose} | |
47 | ||
48 | \func{void}{Close}{\void} | |
49 | ||
50 | Closes the file. | |
51 | ||
52 | \membersection{wxFile::Create}\label{wxfilecreate} | |
53 | ||
54 | \func{bool}{Create}{\param{const char*}{ filename}, \param{bool}{ overwrite = FALSE}} | |
55 | ||
56 | Creates a file for writing. If the file already exists, setting {\bf overwrite} to TRUE | |
57 | will ensure it is overwritten. | |
58 | ||
59 | \membersection{wxFile::Eof}\label{wxfileeof} | |
60 | ||
61 | \constfunc{bool}{Eof}{\void} | |
62 | ||
63 | Returns TRUE if the end of the file has been reached. | |
64 | ||
65 | \membersection{wxFile::Exists}\label{wxfileexists} | |
66 | ||
67 | \func{static bool}{Exists}{\param{const char*}{ filename}} | |
68 | ||
69 | Returns TRUE if the file exists. | |
70 | ||
71 | \membersection{wxFile::Flush}\label{wxfileflush} | |
72 | ||
73 | \func{bool}{Flush}{\void} | |
74 | ||
75 | Flushes the file descriptor. Not implemented for some Windows compilers. | |
76 | ||
77 | \membersection{wxFile::IsOpened}\label{wxfileisopened} | |
78 | ||
79 | \constfunc{bool}{IsOpened}{\void} | |
80 | ||
81 | Returns TRUE if the file has been opened. | |
82 | ||
83 | \membersection{wxFile::Length}\label{wxfilelength} | |
84 | ||
85 | \constfunc{off\_t}{Length}{\void} | |
86 | ||
87 | Returns the length of the file. | |
88 | ||
89 | \membersection{wxFile::Open}\label{wxfileopen} | |
90 | ||
91 | \func{bool}{Open}{\param{const char*}{ filename}, \param{wxFile::OpenMode}{ mode = wxFile::read}} | |
92 | ||
93 | Opens the file, returning TRUE if successful. | |
94 | ||
95 | \wxheading{Parameters} | |
96 | ||
97 | \docparam{filename}{The filename.} | |
98 | ||
99 | \docparam{mode}{The mode in which to open the file. May be one of {\bf wxFile::read}, {\bf wxFile::write} and {\bf wxFile::read\_write}.} | |
100 | ||
101 | \membersection{wxFile::Read}\label{wxfileread} | |
102 | ||
103 | \func{off\_t}{Read}{\param{void*}{ buffer}, \param{off\_t}{ count}} | |
104 | ||
105 | Reads the specified number of bytes into a buffer, returning the actual number read. | |
106 | ||
107 | \wxheading{Parameters} | |
108 | ||
109 | \docparam{buffer}{A buffer to receive the data.} | |
110 | ||
111 | \docparam{count}{The number of bytes to read.} | |
112 | ||
113 | \wxheading{Return value} | |
114 | ||
115 | The number of bytes read, or the symbol {\bf ofsInvalid} (-1) if there was an error. | |
116 | ||
117 | \membersection{wxFile::Seek}\label{wxfileseek} | |
118 | ||
119 | \func{off\_t}{Seek}{\param{off\_t }{ofs}, \param{wxFile::SeekMode }{mode = wxFile::FromStart}} | |
120 | ||
121 | Seeks to the specified position. | |
122 | ||
123 | \wxheading{Parameters} | |
124 | ||
125 | \docparam{ofs}{Offset to seek to.} | |
126 | ||
127 | \docparam{mode}{One of {\bf wxFile::FromStart}, {\bf wxFile::FromEnd}, {\bf wxFile::FromCurrent}.} | |
128 | ||
129 | \wxheading{Return value} | |
130 | ||
131 | The actual offset position achieved, or ofsInvalid on failure. | |
132 | ||
133 | \membersection{wxFile::SeekEnd}\label{wxfileseekend} | |
134 | ||
135 | \func{off\_t}{SeekEnd}{\param{off\_t }{ofs = 0}} | |
136 | ||
137 | Moves the file pointer to the specified number of bytes before the end of the file. | |
138 | ||
139 | \wxheading{Parameters} | |
140 | ||
141 | \docparam{ofs}{Number of bytes before the end of the file.} | |
142 | ||
143 | \wxheading{Return value} | |
144 | ||
145 | The actual offset position achieved, or ofsInvalid on failure. | |
146 | ||
147 | \membersection{wxFile::Tell}\label{wxfiletell} | |
148 | ||
149 | \constfunc{off\_t}{Tell}{\void} | |
150 | ||
151 | Returns the current position. | |
152 | ||
153 | \membersection{wxFile::Write}\label{wxfilewrite} | |
154 | ||
155 | \func{bool}{Write}{\param{const void*}{ buffer}, \param{off\_t}{ count}} | |
156 | ||
157 | Writes the specified number of bytes from a buffer. | |
158 | ||
159 | \wxheading{Parameters} | |
160 | ||
161 | \docparam{buffer}{A buffer containing the data.} | |
162 | ||
163 | \docparam{count}{The number of bytes to write.} | |
164 | ||
165 | \wxheading{Return value} | |
166 | ||
167 | TRUE if the operation was successful. | |
168 | ||
169 |