Parse command-line arguments: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: changed/added comments and whitespace, changed indentations, separated blocks of comments into preformatted text blocks.)
(Added FreeBASIC)
Line 153: Line 153:
{[a: true, b: true, c: "yes", no_flag: true, verbose: true],
{[a: true, b: true, c: "yes", no_flag: true, verbose: true],
["apple", "banana"], [{"-V", nil}, {"-a", "1"}, {"-b", "t"}]}</lang>
["apple", "banana"], [{"-V", nil}, {"-a", "1"}, {"-b", "t"}]}</lang>

=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64

' Program (commandline.exe) invoked like this:
' commandline nc -v -n -z -w 1 192.168.1.2 1-1000

Dim argc As Integer = __FB_ARGC__
Dim argv As ZString Ptr Ptr = __FB_ARGV__

Print "The program was invoked with the following command line arguments:"
Print

For i As Integer = 0 To argc - 1
Print "Arg"; i + 1; " = "; *argv[i]
Next

Print
Print "Press any key to quit"
Sleep</lang>

{{out}}
<pre>
The program was invoked with the following command line arguments:

Arg 1 = commandline
Arg 2 = nc
Arg 3 = -v
Arg 4 = -n
Arg 5 = -z
Arg 6 = -w
Arg 7 = 1
Arg 8 = 192.168.1.2
Arg 9 = 1-1000
</pre>


=={{header|Go}}==
=={{header|Go}}==