[fpc-pascal]RE: Read from command line

Jeff Pohlmeyer yetanothergeek at yahoo.com
Mon Sep 8 18:32:40 CEST 2003


There is a subtle difference between ParamStr(0) and argv[0]:

  argv[0] is the verbatim command passed to the shell.
  ParamStr(0) is the full path to the executable.

Neither of these will dereference a symlink, to do that you
can call ReadLink recursively, or ReadLink(/proc/<PID>/exe)


Also note that the argv's are zero-based pchar's,
the paramstr's are one-based pascal strings.


The argv's are also writeable:

 This works:
   argv[0][1]:='x';

 But this doesn't:
   ParamStr(0)[1]:='x';



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com




More information about the fpc-pascal mailing list