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 - argv() return individual command line arguments http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 argv()              Return individual command line arguments
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   func char argv extern
   param value uint nArgument

 Arguments
   nArgument is the number of the argument to return.

 Return
   One of the command line arguments as a character string.

 Description
   The argv() function provides an alternative way of accessing command
   line parameters; it returns one 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. Arguments are returned without surrounding
   spaces. 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_argv
   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_argv()
   endproc

See Also: argc() main()

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