OS_ConvertToArguments

C Specification

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

Arguments

str The character 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

The character string is converted into argument data and stored in the specified buffer.

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

Specify the character 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 anaylsis from the item corresponding to OS_GetArgv(1), the dummy program name "dummy" is assigned to the character 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,
OS_GetArgumentBuffer, OS_ConvertToArguments

Revision History

09/09/2005 Initial version.