Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - argc() return the number of command line arguments http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 argc()              Return the number of command line arguments
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   func uint argc extern

 Arguments
   None.

 Return
   The number of command line arguments excluding the executable name.

 Description
   The argc() function returns the number of the arguments that were
   supplied on the command line when the current program was invoked.
   The function works correctly in any place of the program, that is outside
   of the main() function as well. The name of the executable file is
   not counted. Command line arguments can have embedded spaces if
   surrounded by a pair of the " or ' characters; such composite
   arguments are counted as one argument.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   proc Test_argc
   vardef
      uint n
      uint nArg
   enddef
   nArg := argc()
   ? "Number of command line arguments:", istr( nArg )
   for n := 1 to nArg
      ? "Argument " + istr( n ) + ":", "|" + argv( n ) + "|"
   next
   endproc

   proc main
   Test_argc()
   endproc

See Also: argv() main()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson