Board index » delphi » Passing Strings as Var Parameters

Passing Strings as Var Parameters

How do you pass a string as a var Parameter in a procedure?

 

Re:Passing Strings as Var Parameters


with the keyword var before the variable in the parameters list of course.
maybe your problem is when you declare a string variable with a defined
length like
var
        st:string[50];
if you do so you must uncheck the strict var-strings in the compiler
options menu.

 Syntax options
  [ ] Strict var-strings
  [ ] Complete boolean eval
  [X] Extended syntax
  [ ] Typed @ operator
  [ ] Open parameters

good luck
--
F.C.Porto - The best team in the universe

Frank   <Jblaz...@msn.com> wrote in article <00009410+00003...@msn.com>...

Quote
> How do you pass a string as a var Parameter in a procedure?

Re:Passing Strings as Var Parameters


Jblaz...@msn.com (Frank  ) wrote:

Quote
>How do you pass a string as a var Parameter in a procedure?

Assuming that you already know,
PROCEDURE Stuff(VAR s:String);
my guess is that you are trying to pass a dimensioned string, such as
an 80 char string from a disk textfile.

The easiest way to do this for both FUNCTIONS and PROCEDURES without
fooling with compiler instructions is:

TYPE   s80 = String[80];   (* dimensions to suit your application *)

Now you can use:

PROCEDURE Stuff(VAR s:s80);

Regards,
Clif  <clifp...@airmail.net>

Other Threads