]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/ftp.tex
A few spelling typos fixed
[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
296ec7d3 19\latexignore{\rtfignore{\wxheading{Members}}}
7d2946d2
GL
20
21\membersection{wxFTP::SendCommand}
22
6be663cf 23\func{bool}{SendCommand}{\param{const wxString\&}{ command}, \param{char }{ret}}
7d2946d2 24
605d715d 25Send the specified {\it command} to the FTP server. {\it ret} specifies
7d2946d2
GL
26the expected result.
27
28\wxheading{Return value}
29
fa482912 30TRUE if the command has been sent successfully, else FALSE.
7d2946d2
GL
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
605d715d 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
605d715d 83Delete the file specified by {\it path}. Returns TRUE if successful.
7d2946d2
GL
84
85% ----------------------------------------------------------------------------
86
9a1b2c28 87\membersection{wxFTP::SetUser}
721b32e0 88
9a1b2c28
GL
89\func{void}{SetUser}{\param{const wxString\&}{ user}}
90
91Sets the user name to be sent to the FTP server to be allowed to log in.
92
93\wxheading{Default value}
94
95The default value of the user name is "anonymous".
96
97\wxheading{Remark}
98
99This parameter can be included in a URL if you want to use the URL manager.
294e9a7a 100For example, you can use: "ftp://a\_user:a\_password@a.host:service/a\_directory/a\_file"
9a1b2c28
GL
101to specify a user and a password.
102
103\membersection{wxFTP::SetPassword}
721b32e0 104
9a1b2c28
GL
105\func{void}{SetPassword}{\param{const wxString\&}{ passwd}}
106
107Sets the password to be sent to the FTP server to be allowed to log in.
108
109\wxheading{Default value}
110
111The default value of the user name is your email address. For example, it could
112be "username@userhost.domain". This password is built by getting the current
113user name and the host name of the local machine from the system.
114
115\wxheading{Remark}
116
117This parameter can be included in a URL if you want to use the URL manager.
294e9a7a 118For example, you can use: "ftp://a\_user:a\_password@a.host:service/a\_directory/a\_file"
9a1b2c28
GL
119to specify a user and a password.
120
121% ----------------------------------------------------------------------------
122\membersection{wxFTP::GetList}
721b32e0 123
8e907a13 124\func{bool}{GetList}{\param{wxArrayString\& }{files}, \param{const wxString\&}{ wildcard = ""}}
9a1b2c28
GL
125
126The GetList function is quite low-level. It returns the list of the files in
605d715d 127the current directory. The list can be filtered using the {\it wildcard} string.
8e907a13 128If {\it wildcard} is empty (default), it will return all files in directory.
9a1b2c28
GL
129
130The form of the list can change from one peer system to another. For example,
131for a UNIX peer system, it will look like this:
296ec7d3 132
9a1b2c28
GL
133\begin{verbatim}
134-r--r--r-- 1 guilhem lavaux 12738 Jan 16 20:17 cmndata.cpp
135-r--r--r-- 1 guilhem lavaux 10866 Jan 24 16:41 config.cpp
136-rw-rw-rw- 1 guilhem lavaux 29967 Dec 21 19:17 cwlex_yy.c
137-rw-rw-rw- 1 guilhem lavaux 14342 Jan 22 19:51 cwy_tab.c
138-r--r--r-- 1 guilhem lavaux 13890 Jan 29 19:18 date.cpp
139-r--r--r-- 1 guilhem lavaux 3989 Feb 8 19:18 datstrm.cpp
140\end{verbatim}
141
142But on Windows system, it will look like this:
296ec7d3 143
9a1b2c28
GL
144\begin{verbatim}
145winamp~1 exe 520196 02-25-1999 19:28 winamp204.exe
146 1 file(s) 520 196 bytes
147\end{verbatim}
148
8e907a13
VZ
149Return value: TRUE if the file list was successfully retrieved, FALSE
150otherwise.
9a1b2c28
GL
151
152% ----------------------------------------------------------------------------
153
7d2946d2
GL
154\membersection{wxFTP::GetOutputStream}
155
6be663cf 156\func{wxOutputStream *}{GetOutputStream}{\param{const wxString\&}{ file}}
7d2946d2 157
605d715d 158Initializes an output stream to the specified {\it file}. The returned
6be663cf 159stream has all but the seek functionality of wxStreams. When the user finishes
7d2946d2
GL
160writing data, he has to delete the stream to close it.
161
162\wxheading{Return value}
163
164An initialized write-only stream.
6be663cf 165
7f42cff1
GL
166\wxheading{See also}
167
168\helpref{wxOutputStream}{wxoutputstream}
0492c5a0 169
9a1b2c28
GL
170% ----------------------------------------------------------------------------
171
172\membersection{wxFTP::GetInputStream}\label{wxftpgetinput}
173
174\func{wxInputStream *}{GetInputStream}{\param{const wxString\&}{ path}}
175
fa482912
JS
176Creates a new input stream on the the specified path. You can use all but the seek
177functionality of wxStream. Seek isn't available on all streams. For example,
178http or ftp streams do not deal with it. Other functions like Tell
179are not available for this sort of stream, at present.
9a1b2c28
GL
180You will be notified when the EOF is reached by an error.
181
182\wxheading{Return value}
183
f6bcfd97 184Returns NULL if an error occurred (it could be a network failure or the fact
9a1b2c28
GL
185that the file doesn't exist).
186
fa482912
JS
187Returns the initialized stream. You will have to delete it yourself when you
188don't need it anymore. The destructor closes the DATA stream connection but
189will leave the COMMAND stream connection opened. It means that you can still
190send new commands without reconnecting.
9a1b2c28
GL
191
192\wxheading{Example of a standalone connection (without wxURL)}
193
194\begin{verbatim}
195 wxFTP ftp;
70be2567 196 wxInputStream *in_stream;
9a1b2c28
GL
197 char *data;
198
199 ftp.Connect("a.host.domain");
70be2567
VS
200 ftp.ChDir("a_directory");
201 in_stream = ftp.GetInputStream("a_file_to_get");
9a1b2c28 202
70be2567 203 data = new char[in_stream->StreamSize()];
9a1b2c28 204
70be2567
VS
205 in_stream->Read(data, in_stream->StreamSize());
206 if (in_stream->LastError() != wxStream_NOERROR) {
9a1b2c28
GL
207 // Do something.
208 }
209
70be2567 210 delete in_stream; /* Close the DATA connection */
9a1b2c28
GL
211
212 ftp.Close(); /* Close the COMMAND connection */
213\end{verbatim}
214
215\wxheading{See also}
216
217\helpref{wxInputStream}{wxinputstream}
721b32e0 218