Command-line arguments: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add CLU) |
mNo edit summary |
||
Line 164: | Line 164: | ||
the argument #6 is 3 |
the argument #6 is 3 |
||
the argument #7 is ... |
the argument #7 is ... |
||
</pre> |
|||
=={{header|Amazing Hopper}}== |
|||
The main function "main(argv,argc)" is a macro-defined in HOPPER.H: get the arguments, and put them into array ARGV; ARGC have total arguments. |
|||
VERSION 1: |
|||
<lang Amazing Hopper> |
|||
#include <hopper.h> |
|||
main(argv, argc) |
|||
{"This program named: "},[1]get(argv),println |
|||
for(i=2, {i}lethan(argc),++i) |
|||
{"Argument #",i," = "}[i]get(argv),println |
|||
next |
|||
exit(0) |
|||
</lang> |
|||
VERSION 2: |
|||
<lang Amazing Hopper> |
|||
#include <hopper.h> |
|||
main: |
|||
total arg, argc=0,mov(argc) |
|||
{"This program named: ",[&1]},println |
|||
i=2 |
|||
__CNT_ARGS__: |
|||
{"Argumento #",i," = ",[&i]}println |
|||
++i,{argc,i}jle(__CNT_ARGS__) |
|||
exit(0) |
|||
</lang> |
|||
etc... |
|||
{{out}} |
|||
<pre> |
|||
This program named: src/args1.com |
|||
Argumento #2 = 1 |
|||
Argumento #3 = Rosseta code |
|||
Argumento #4 = 100 |
|||
</pre> |
</pre> |
||