首页 > 其他 > 详细

function ParamStr(i:LongInt):string

时间:2020-05-14 23:44:06      阅读:93      评论:0      收藏:0      [点我收藏+]

转载地址:https://www.freepascal.org/docs-html/rtl/system/paramstr.html

ParamStr

Return value of a command-line argument.

Declaration

Source position: systemh.inc line 1397

function ParamStr(

  l: LongInt

):string;

Description

Paramstr returns the L-th command-line argument. L must be between 0 and Paramcount, these values included. The zeroth argument is the path and file name with which the program was started.

The command-line parameters will be truncated to a length of 255, even though the operating system may support bigger command-lines. The Objpas unit (used in objfpc or delphi mode) defines versions of Paramstr which return the full-length command-line arguments, using ansistrings.

In the interest of portability, the ParamStr function tries to behave the same on all operating systems: like the original ParamStr function in Turbo Pascal. This means even on Unix, paramstr(0) returns the full path to the program executable. A notable exception is Mac OS X, where the return value depends on how the application was started. It may be that just the name of the application is returned (in case of a command-line launch)

In general, it‘s a bad idea to rely on the location of the binary. Often, this goes against best OS practices. Configuration data should (or can) not be stored next to the binary, but on designated locations. What locations these are, is very much operating system dependent. Therefore, ParamStr(0) should be used with care.

For an example, see Paramcount.

function ParamStr(i:LongInt):string

原文:https://www.cnblogs.com/huiy/p/12892174.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!