IPC@CHIP® RTOS-LNX – API Documentation

Header image

Main page


◆ CGI_GetArgument()

int CGI_GetArgument ( char **  name,
char **  value,
rpCgiPtr  CgiRequest 
)

Returns the next available argument (name-value pair).

Parameters
[out]nameOutput Parameter: A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the argument-name.
[out]valueOutput Parameter: A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the argument-value.
[in]CgiRequestInput Parameter: The CGI request pointer which was passed to the CGI function.
Returns
zero (CGI_ARGUMENT_ERR_OK) on success, -1 (CGI_ARGUMENT_ERR_NONE) on failure, which means no more arguments available.
Note
On the first call the function returns the first found argument. On next calls the function returns the next found argument, until no more arguments could be found. Note that this function must be called within the context of a CGI function. The pointers returned by the function are valid only while the CGI function is active. On return from the CGI function the pointer will become invalid.

The name, value pairs returned by this function are already decoded. You don't have to call CGI_UrlDeocde() yourself.
Example:
char *name;
char *value;
while ( CGI_GetArgument( &name, &value, CgiRequest ) == CGI_ARGUMENT_ERR_OK )
{
printf("Argument found:\r\n"
"Name : %s\r\n"
"Value: %s\r\n",
name, value);
}
Since
V0.80





Top of page | Main page

Copyright © 2017 Beck IPC GmbH
Generated on Tue Dec 12 2017 09:23:36 by Doxygen 1.8.13