]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/ftp.tex
Some doc fixes
[wxWidgets.git] / docs / latex / wx / ftp.tex
CommitLineData
7d2946d2
GL
1\section{\class{wxFTP}}\label{wxftp}
2
3\wxheading{Derived from}
4
5\helpref{wxProtocol}{wxprotocol}
6
954b8ae6
JS
7\wxheading{Include files}
8
9a1b2c28 9<wx/protocol/ftp.h>
954b8ae6 10
7d2946d2
GL
11\wxheading{See also}
12
13\helpref{wxSocketBase}{wxsocketbase}
14
15% ----------------------------------------------------------------------------
16% Members
17% ----------------------------------------------------------------------------
18
19\latexignore{\rtfignore{\membersection{Members}}}
20
21\membersection{wxFTP::SendCommand}
22
6be663cf 23\func{bool}{SendCommand}{\param{const wxString\&}{ command}, \param{char }{ret}}
7d2946d2
GL
24
25Send the specified \it{command} to the FTP server. \it{ret} specifies
26the expected result.
27
28\wxheading{Return value}
29
30TRUE, if the command has been sent successfully, else FALSE.
31
32% ----------------------------------------------------------------------------
33
34\membersection{wxFTP::GetLastResult}
35
36\func{const wxString\&}{GetLastResult}{\void}
37
38Returns the last command result.
39
40% ----------------------------------------------------------------------------
41
42\membersection{wxFTP::ChDir}
43
6be663cf 44\func{bool}{ChDir}{\param{const wxString\&}{ dir}}
7d2946d2
GL
45
46Change the current FTP working directory.
40b480c3 47Returns TRUE if successful.
7d2946d2
GL
48
49\membersection{wxFTP::MkDir}
50
6be663cf 51\func{bool}{MkDir}{\param{const wxString\&}{ dir}}
7d2946d2
GL
52
53Create the specified directory in the current FTP working directory.
40b480c3 54Returns TRUE if successful.
7d2946d2
GL
55
56\membersection{wxFTP::RmDir}
57
6be663cf 58\func{bool}{RmDir}{\param{const wxString\&}{ dir}}
7d2946d2
GL
59
60Remove the specified directory from the current FTP working directory.
40b480c3 61Returns TRUE if successful.
7d2946d2
GL
62
63\membersection{wxFTP::Pwd}
64
65\func{wxString}{Pwd}{\void}
66
67Returns the current FTP working directory.
68
69% ----------------------------------------------------------------------------
70
71\membersection{wxFTP::Rename}
72
6be663cf 73\func{bool}{Rename}{\param{const wxString\&}{ src}, \param{const wxString\&}{ dst}}
7d2946d2 74
40b480c3 75Rename the specified \it{src} element to \it{dst}. Returns TRUE if successful.
7d2946d2
GL
76
77% ----------------------------------------------------------------------------
78
79\membersection{wxFTP::RmFile}
80
6be663cf 81\func{bool}{RmFile}{\param{const wxString\&}{ path}}
7d2946d2 82
40b480c3 83Delete the file specified by \it{path}. Returns TRUE if successful.
7d2946d2
GL
84
85% ----------------------------------------------------------------------------
86
9a1b2c28
GL
87\membersection{wxFTP::SetUser}
88\func{void}{SetUser}{\param{const wxString\&}{ user}}
89
90Sets the user name to be sent to the FTP server to be allowed to log in.
91
92\wxheading{Default value}
93
94The default value of the user name is "anonymous".
95
96\wxheading{Remark}
97
98This parameter can be included in a URL if you want to use the URL manager.
99For example, you can use: "ftp://a_user:a_password@a.host:service/a_directory/a_file"
100to specify a user and a password.
101
102\membersection{wxFTP::SetPassword}
103\func{void}{SetPassword}{\param{const wxString\&}{ passwd}}
104
105Sets the password to be sent to the FTP server to be allowed to log in.
106
107\wxheading{Default value}
108
109The default value of the user name is your email address. For example, it could
110be "username@userhost.domain". This password is built by getting the current
111user name and the host name of the local machine from the system.
112
113\wxheading{Remark}
114
115This parameter can be included in a URL if you want to use the URL manager.
116For example, you can use: "ftp://a_user:a_password@a.host:service/a_directory/a_
117file"
118to specify a user and a password.
119
120% ----------------------------------------------------------------------------
121\membersection{wxFTP::GetList}
122\func{wxList *}{GetList}{\param{const wxString\&}{ wildcard}}
123
124The GetList function is quite low-level. It returns the list of the files in
125the current directory. The list can be filtered using the \it{wildcard} string.
126If \it{wildcard} is a NULL string, it will return all files in directory.
127
128The form of the list can change from one peer system to another. For example,
129for a UNIX peer system, it will look like this:
130\begin{verbatim}
131-r--r--r-- 1 guilhem lavaux 12738 Jan 16 20:17 cmndata.cpp
132-r--r--r-- 1 guilhem lavaux 10866 Jan 24 16:41 config.cpp
133-rw-rw-rw- 1 guilhem lavaux 29967 Dec 21 19:17 cwlex_yy.c
134-rw-rw-rw- 1 guilhem lavaux 14342 Jan 22 19:51 cwy_tab.c
135-r--r--r-- 1 guilhem lavaux 13890 Jan 29 19:18 date.cpp
136-r--r--r-- 1 guilhem lavaux 3989 Feb 8 19:18 datstrm.cpp
137\end{verbatim}
138
139But on Windows system, it will look like this:
140\begin{verbatim}
141winamp~1 exe 520196 02-25-1999 19:28 winamp204.exe
142 1 file(s) 520 196 bytes
143\end{verbatim}
144
145The list is a string list and one node corresponds to a line sent by the peer.
146
147% ----------------------------------------------------------------------------
148
7d2946d2
GL
149\membersection{wxFTP::GetOutputStream}
150
6be663cf 151\func{wxOutputStream *}{GetOutputStream}{\param{const wxString\&}{ file}}
7d2946d2
GL
152
153Initializes an output stream to the specified \it{file}. The returned
6be663cf 154stream has all but the seek functionality of wxStreams. When the user finishes
7d2946d2
GL
155writing data, he has to delete the stream to close it.
156
157\wxheading{Return value}
158
159An initialized write-only stream.
6be663cf 160
7f42cff1
GL
161\wxheading{See also}
162
163\helpref{wxOutputStream}{wxoutputstream}
0492c5a0 164
9a1b2c28
GL
165% ----------------------------------------------------------------------------
166
167\membersection{wxFTP::GetInputStream}\label{wxftpgetinput}
168
169\func{wxInputStream *}{GetInputStream}{\param{const wxString\&}{ path}}
170
171Creates a new input stream on the the specified path. You can use all but seek
172functionnality of wxStream. Seek isn't available on all stream. For example,
173http or ftp streams doesn't deal with it. Other functions like Tell
174aren't available for the moment for this sort of stream.
175You will be notified when the EOF is reached by an error.
176
177\wxheading{Return value}
178
179Returns NULL if an error occured (it could be a network failure or the fact
180that the file doesn't exist).
181
182Returns the initialized stream. You will have to delete it yourself once you
183don't use it anymore. The destructor close the DATA stream connection but
184will leave the COMMAND stream connection opened. It means that you still
185can send new commands without reconnecting.
186
187\wxheading{Example of a standalone connection (without wxURL)}
188
189\begin{verbatim}
190 wxFTP ftp;
191 wxInputStream *in\_stream;
192 char *data;
193
194 ftp.Connect("a.host.domain");
195 ftp.ChDir("a\_directory");
196 in\_stream = ftp.GetInputStream("a\_file\_to\_get");
197
198 data = new char[in\_stream->StreamSize()];
199
200 in\_stream->Read(data, in\_stream->StreamSize());
201 if (in\_stream->LastError() != wxStream\_NOERROR) {
202 // Do something.
203 }
204
205 delete in\_stream; /* Close the DATA connection */
206
207 ftp.Close(); /* Close the COMMAND connection */
208\end{verbatim}
209
210\wxheading{See also}
211
212\helpref{wxInputStream}{wxinputstream}