OS_GetArgc

Syntax

#include <nitro/os.h>
int OS_GetArgc( void );
 

Arguments

None.

Return Values

The number of arguments including the program name are returned.

However, if argument data is not stored in the argument buffer, zero is returned. If data is stored in the argument buffer and there are no arguments, one is returned.

Description

Returns the number of arguments according to the argument data embedded in the ROM file.

For NITRO ROMs, arguments are embedded as argument data in the ROM file using the buryarg tool. For TWL ROMs, arguments are embedded as argument data in the ROM file using the buryarg.TWL tool. This function is used to look up the the number of arguments within the argument data, but since the program name (the ROM file name specified when buryarg is executed) is included in the count, this function will return 1 even though there are no arguments.

Zero is returned if no argument data has been embedded.

Always returns zero with FINALROM builds.

Example

If buryarg main.srl A B C was specified, running the following code will display argc=3.

OS_Printf( "argc=%d\n", OS_GetArgc() );

(The same is true with buryarg.TWL)

See Also

OS_GetArgv, OS_GetOpt
buryarg Tool, buryarg.TWL Tool

Revision History

2008/06/23 Split into separate cases for NITRO and TWL.
2005/07/21 Initial version.


CONFIDENTIAL