The GetText method is used to download a text file or
retrieve the text output from a script and
store the contents in a string buffer. Because
binary data can include embedded null characters which would truncate the
string, this method should only be used with text files or script
output that is known to be textual. For example, it is safe to use
this method when a resource returns HTML or XML data, but should not
be used if it returns an image or executable file.
This method has been included as a convenience for applications
that need to retrieve relatively small amounts of textual data and manipulate the
contents as a string. If the Unicode version of this method is
called, the text is automatically converted to a
Unicode string. If the maximum amount of data being returned is unknown or the
amount of text 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.
HTTP_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.