- or download this
#include <stdio.h>
int main(int argc, char* argv[])
...
for (i = 0; i < argc; ++i) { printf("%d:%s:\n", i, argv[i]); }
return 0;
}
- or download this
> arg.exe "abc "" xyz"
- or download this
0:arg.exe:
1:abc " xyz:
- or download this
for my $arg (@ARGV) { print "$arg:\n" }
- or download this
> perl arg.pl "abc "" xyz"
- or download this
abc ":
xyz:
- or download this
use strict;
use warnings;
...
$cmdline =~ tr/\0//d; # remove any NULLs left over from pack Z*
$cmdline =~ s/\s+$//; # remove trailing white space
print "cmdline=$cmdline:\n";