1 \section{\class{wxFile
}}\label{wxfile
}
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.
6 \wxheading{Derived from
}
10 \latexignore{\rtfignore{\wxheading{Members
}}}
12 \membersection{wxFile::wxFile
}\label{wxfileconstr
}
14 \func{}{wxFile
}{\void}
18 \func{}{wxFile
}{\param{const char*
}{ filename
},
\param{wxFile::OpenMode
}{ mode = wxFile::read
}}
20 Opens a file with the given mode.
22 \func{}{wxFile
}{\param{int
}{ fd
}}
24 Opens a file with the given file descriptor, which has already been opened.
26 \wxheading{Parameters
}
28 \docparam{filename
}{The filename.
}
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}.
}
32 \docparam{fd
}{An existing file descriptor.
}
34 \membersection{wxFile::
\destruct{wxFile
}}
36 \func{}{\destruct{wxFile
}}{\void}
38 Destructor. This is not virtual, for efficiency.
40 \membersection{wxFile::Attach
}\label{wxfileattach
}
42 \func{void
}{Attach
}{\param{int
}{ fd
}}
44 Attaches an existing file descriptor to the wxFile object.
46 \membersection{wxFile::Close
}\label{wxfileclose
}
48 \func{void
}{Close
}{\void}
52 \membersection{wxFile::Create
}\label{wxfilecreate
}
54 \func{bool
}{Create
}{\param{const char*
}{ filename
},
\param{bool
}{ overwrite = FALSE
}}
56 Creates a file for writing. If the file already exists, setting
{\bf overwrite
} to TRUE
57 will ensure it is overwritten.
59 \membersection{wxFile::Eof
}\label{wxfileeof
}
61 \constfunc{bool
}{Eof
}{\void}
63 Returns TRUE if the end of the file has been reached.
65 \membersection{wxFile::Exists
}\label{wxfileexists
}
67 \func{static bool
}{Exists
}{\param{const char*
}{ filename
}}
69 Returns TRUE if the file exists.
71 \membersection{wxFile::Flush
}\label{wxfileflush
}
73 \func{bool
}{Flush
}{\void}
75 Flushes the file descriptor. Not implemented for some Windows compilers.
77 \membersection{wxFile::IsOpened
}\label{wxfileisopened
}
79 \constfunc{bool
}{IsOpened
}{\void}
81 Returns TRUE if the file has been opened.
83 \membersection{wxFile::Length
}\label{wxfilelength
}
85 \constfunc{off
\_t}{Length
}{\void}
87 Returns the length of the file.
89 \membersection{wxFile::Open
}\label{wxfileopen
}
91 \func{bool
}{Open
}{\param{const char*
}{ filename
},
\param{wxFile::OpenMode
}{ mode = wxFile::read
}}
93 Opens the file, returning TRUE if successful.
95 \wxheading{Parameters
}
97 \docparam{filename
}{The filename.
}
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}.
}
101 \membersection{wxFile::Read
}\label{wxfileread
}
103 \func{off
\_t}{Read
}{\param{void*
}{ buffer
},
\param{off
\_t}{ count
}}
105 Reads the specified number of bytes into a buffer, returning the actual number read.
107 \wxheading{Parameters
}
109 \docparam{buffer
}{A buffer to receive the data.
}
111 \docparam{count
}{The number of bytes to read.
}
113 \wxheading{Return value
}
115 The number of bytes read, or the symbol
{\bf ofsInvalid
} (-
1) if there was an error.
117 \membersection{wxFile::Seek
}\label{wxfileseek
}
119 \func{off
\_t}{Seek
}{\param{off
\_t }{ofs
},
\param{wxFile::SeekMode
}{mode = wxFile::FromStart
}}
121 Seeks to the specified position.
123 \wxheading{Parameters
}
125 \docparam{ofs
}{Offset to seek to.
}
127 \docparam{mode
}{One of
{\bf wxFile::FromStart
},
{\bf wxFile::FromEnd
},
{\bf wxFile::FromCurrent
}.
}
129 \wxheading{Return value
}
131 The actual offset position achieved, or ofsInvalid on failure.
133 \membersection{wxFile::SeekEnd
}\label{wxfileseekend
}
135 \func{off
\_t}{SeekEnd
}{\param{off
\_t }{ofs =
0}}
137 Moves the file pointer to the specified number of bytes before the end of the file.
139 \wxheading{Parameters
}
141 \docparam{ofs
}{Number of bytes before the end of the file.
}
143 \wxheading{Return value
}
145 The actual offset position achieved, or ofsInvalid on failure.
147 \membersection{wxFile::Tell
}\label{wxfiletell
}
149 \constfunc{off
\_t}{Tell
}{\void}
151 Returns the current position.
153 \membersection{wxFile::Write
}\label{wxfilewrite
}
155 \func{bool
}{Write
}{\param{const void*
}{ buffer
},
\param{off
\_t}{ count
}}
157 Writes the specified number of bytes from a buffer.
159 \wxheading{Parameters
}
161 \docparam{buffer
}{A buffer containing the data.
}
163 \docparam{count
}{The number of bytes to write.
}
165 \wxheading{Return value
}
167 TRUE if the operation was successful.