The GetText method is used to download a text file and
store the contents in a string buffer. This method will always set
the file type to FILE_TYPE_ASCII before downloading the file, and will
restore the default file type before the method returns. Because
binary files can include embedded null characters, this method should
only be used with known text files.
This method has been included as a convenience for applications
that need to retrieve relatively small text files and manipulate the
contents as a string. If the Unicode version of this method is
called, the contents of the text file is automatically converted to a
Unicode string. If the size of the file is unknown or the text
file is very large, it is recommended that you use the GetData
or GetFile methods.
If you use the GetFileSize method to determine how
large the string buffer should be prior to calling this method, it
is important to be aware that the actual number of characters may
differ based on the end-of-line conventions used by the host operating
system. For example, if you call GetFileSize to obtain the
size of a text file on a UNIX system, the value will not be large
enough to store the complete file because UNIX uses a single linefeed
(LF) character to indicate the end-of-line, while a Windows system
will use a carriage-return and linefeed (CRLF) pair. To accommodate
this difference, you should always allocate extra memory for the
string buffer to store the additional end-of-line characters.
FTP_EVENT_PROGRESS event will be periodically fired, enabling the
application to update any user interface controls. Event notification
must be enabled, either by calling EnableEvents, or by
registering a callback function using the RegisterEvent
method.
To determine the current status of a file transfer while it is in
progress, use the GetTransferStatus method.