🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #140

Re: paramstr longer than 127 characters. Is it possible?

#140
From: Wolfgang Ehrhardt
Date: Mon, 28 Jan 2002 21:15
57 lines
2971 bytes
On Mon, 28 Jan 2002 14:32:20 +0000 (UTC), andrew@SPAMNOyahoo.com
(Andy) wrote:

>Hello,
>
>I write a program, which must works in batch mode - user select some files 
>in explorer, drag'em to the program and program starts to calculate every 
>separate input. Code looks like below:
>
>...   
>for i :=1 to ParamCount do
>    	begin
>    	execute program for paramstr(i);
>    	end;
>...
>
>This works OK untill paramstr is not longer that 127 characters. Same code 
>compilled with free pascal seems has two times longer limit.
>Is there a way to process any number of input files, without limits?
>
>Thanks,
>Andy

If you are working under WIN98 (other WIN version may also work) you
can use the environment variable CMDLINE:

example:

uses dos;
begin
  writeln('Command line: ', GetEnv('CMDLINE'));
end.

In the following screen output, cl is called from a bat file:

C:\TMP>cl
1234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890
12345678912345678900
Command line:cl 123456789012345678901234567890123456789012345678901234
5678901234567890123456789012345678901234567890123456789012345678901234
5678901234567890123456789012345678901234567890123456789012345678901234
5678901234567890123456789012345678901234567890123456789012

As you see then full 255 Bytes of a string are used, if you write a
pChar-GetEnv you should get the whole command line.

You should do some processing, because for example WIN file name from
the explorer can contain spaces and may be enclosed in ".

Wolfgang

-- 
In order to e-mail me a reply to this message, you will have 
to remove PLEASE.REMOVE from the address shown in the header.
Technical Details
Message-ID: <3c55be9b.7658540@News.CIS.DFN.DE>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!opentransit.net!fu-berlin.de!uni-berlin.de!c3b3bc87.dial.ision.NET!not-for-mail
References: <91A4ABE38qwerty@193.193.193.102>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10261c,4381055370f4511c
X-Google-Attributes: gid10261c,public
X-Google-Thread: 111659,4381055370f4511c
X-Google-Attributes: gid111659,public
X-Google-Thread: 108ebd,4381055370f4511c
X-Google-Attributes: gid108ebd,public
X-Google-ArrivalTime: 2002-01-28 13:14:52 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!opentransit.net!fu-berlin.de!uni-berlin.de!c3b3bc87.dial.ision.NET!not-for-mail
From: Wolfgang.Ehrhardt.PLEASE.REMOVE@munich.netsurf.de (Wolfgang Ehrhardt)
Newsgroups: comp.lang.pascal.borland,comp.lang.pascal.misc,borland.public.turbopascal
Subject: Re: paramstr longer than 127 characters. Is it possible?
Date: Mon, 28 Jan 2002 21:15:04 GMT
Lines: 57
Message-ID: <3c55be9b.7658540@News.CIS.DFN.DE>
References: <91A4ABE38qwerty@193.193.193.102>
NNTP-Posting-Host: c3b3bc87.dial.ision.net (195.179.188.135)
X-Trace: fu-berlin.de 1012252490 39090956 195.179.188.135 (16 [49092])
X-Newsreader: Forte Free Agent 1.21/32.243