DWC_GHTTPPostAddString

C Specification

#include <dwc.h>

BOOL DWC_GHTTPPostAddString( DWCGHTTPPost* post,
                             const char* key,
                             const char* value);

Description

This function adds data to be uploaded to the HTTP server to a DWCGHTTPPost type object. DWCGHTTPPost type objects are information units to upload data to the HTTP server that are created by the DWC_GHTTPNewPost function.

Data is uploaded to the HTTP server after setting the key string and the value string. The key and value strings are copied and stored in the library. Both strings must be terminated with the NULL character.

Use the DWC_PostGHTTPData function to start the actual data upload.

The sample program below shows an example string as data to be sent to the HTTP server.

"key1=value1&key2=value2"

When more data is added to the same DWCGHTTPPost type object, a string like the one below is added.

"key1=value1&key2=value2&key3=value3&key4=value4…"


DWCGHTTPPost post;

// Creates DWCGHTTPPost type objects
DWC_GHTTPNewPost( &post );

// Sets the data to be uploaded to a DWCGHTTPPost type object
DWC_GHTTPPostAddString( &post, "key1", "value1" );
DWC_GHTTPPostAddString( &post, "key2", "value2" );

Arguments

post Pointer to the DWCGHTTPPost type object to which data will be added.
key String to display the name of the data to be added. Neither a NULL nor an empty string "" can be specified.
value The string of the actual data to be added. If a NULL is specified, an empty string will be specified.

Return Values

TRUE Data successfully added.
FALSE Failed to add data due to a parameter or memory allocation error.

See Also

DWC_GHTTPNewPost, DWC_PostGHTTPData

Revision History

01/18/2006 Added support for the change of the return value to a BOOL. Added conditions to the key argument. 12/16/2005 Added a usage example of the function.
10/27/2005/2005 Initial version.