Help for this page

Select Code to Download


  1. 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;
    }
    
  2. or download this
    > arg.exe "abc "" xyz"
    
  3. or download this
    0:arg.exe:
    1:abc " xyz:
    
  4. or download this
    for my $arg (@ARGV) { print "$arg:\n" }
    
  5. or download this
    > perl arg.pl "abc "" xyz"
    
  6. or download this
    abc ":
    xyz:
    
  7. 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";