DWC_GHTTPPostAddString

Syntax

#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. A DWCGHTTPPost type object is an information unit used to upload data to the HTTP server. It is created by the DWC_GHTTPNewPost function.

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

Use the DWC_PostGHTTPData or DWC_GetGHTTPDataEx2 function to actually start 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=value4Equot;


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 is added.
key A NULL-terminated string that indicates the name of the added data. Neither NULL nor an empty string ("") can be specified.
value A NULL-terminated string for the data to add. If NULL is specified, the empty string will be the data.

Return Values

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

See Also

DWC_GHTTPNewPost
DWC_PostGHTTPData
DWC_GetGHTTPDataEx2

Revision History

2007/10/15 To the explanation for the key argument, added text about the NULL terminator.
2006/12/27 Made revisions to reflect the addition of the DWC_GetGHTTPDataEx2 function.
2006/01/18 Changed the return value to BOOL. Added conditions to the key argument.
2005/12/16 Added examples showing the use of the function.
2005/10/27 Initial version.


CONFIDENTIAL