OS_ConvertToArguments

Syntax

#include <nitro/os.h>
void OS_ConvertToArguments( const char* str,
                                char cs,
                                chat* buffer,
                                u32 bufferSize );
 

Arguments

str String used for the argument data.
cs Separates characters in arguments.
buffer Argument buffer for storing argument data.
bufferSize Size of argument buffer.

Return Values

None.

Description

Converts the string into argument data and stores it in the specified buffer.

This converted argument data can be retrieved by OS_GetArgc, OS_GetArgv, or OS_GetOpt. Although by default the argument buffer area held in the system is used (argument data can be embedded here using the buryarg or buryarg.TWL tools), you can switch to another argument buffer using the OS_SetArgumentBuffer function.

Specify the string used for argument data in str and the separator character for arguments in cs.

Example: If " " (space) is used as the separator and the three arguments "-a", "123", and "test string" are to be passed, specify as follows.
OS_ConvertToArguments( "dummy -a 123 \"test string\"",
                         ' ', buffer, size );
Because OS_GetArgv(0) is the program name by default and OS_GetOpt begins analysis from the item corresponding to OS_GetArgv(1), the dummy program name "dummy" is assigned to the string.
" test string" includes a space (delimiter) in the middle, but is handled as a single argument by enclosing with " ".

buffer specifies the buffer area in which argument data is to be stored. bufferSize specifies the buffer size. Data is not written to the buffer beyond this region.

This function does nothing in the FINALROM build.

See Also

OS_GetArgv
OS_GetArgc
OS_GetOpt
buryarg Tool
buryarg.TWL Tool
OS_GetArgumentBuffer
OS_ConvertToArguments

Revision History

2008/07/09 Added information on buryarg.TWL.
2005/09/09 Initial version.


CONFIDENTIAL