Board index » delphi » Problems with data types.

Problems with data types.

I'm a beginner of Pascal programming. When I want to run the following
program:

(******************************)
program:ExitWindowsExec
uses win31;
var
para:pchar;
begin
        ExitWindowsExec(ParamStr(1), para);
end.
(******************************)

An error message, type mismatch is displayed.
So, I'd like to know how to change the data type of ParamStr(1) which is
a sting to pchar. If any one has any suggestions, welcome to mail reply
to me.

 

Re:Problems with data types.


In article <34BC57CB.1...@plink.cityu.edu.hk>, KinOn
<96008...@plink.cityu.edu.hk> writes

Quote
>I'm a beginner of Pascal programming. When I want to run the following
>program:

>(******************************)
>program:ExitWindowsExec
>uses win31;
>var
>para:pchar;
>begin
>       ExitWindowsExec(ParamStr(1), para);
>end.
>(******************************)

>An error message, type mismatch is displayed.
>So, I'd like to know how to change the data type of ParamStr(1) which is
>a sting to pchar. If any one has any suggestions, welcome to mail reply
>to me.

Use the strings unit and the StrPCopy function. This can convert your
string into a PChar.

Function StrPCopy (Dest : Pchar, Source : String) : Pchar;

And StrPas will convert from a PChar to a String.
--
Pedt Scragg                    <postmas...@pedt.demon.co.uk>

Never curse the Crocodile's mother before crossing the river

Other Threads