Unit 'AmigaDOS' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#morphunits]

GetVar

Returns the value of a local or global variable

Declaration

Source position: amigados.pas line 2230

function GetVar(

  name: PChar;

  buffer: PChar;

  size: LongInt;

  flags: LongInt

):LongInt;

Arguments

name

  

Pointer to a variable name.

buffer

  

A user allocated area which will be used to store the value associated with the variable.

size

  

Length of the buffer region in bytes.

flags

  

combination of type of var to get value of (low 8 bits), and flags to control the behavior of this routine.

Function result

Size of environment variable. -1 indicates that the variable was not defined.

Description

Gets the value of a local or environment variable. It is advised to only use ASCII strings inside variables, but not required. This stops putting characters into the destination when a n is hit, unless GVF_BINARY_VAR is specified. (The n is not stored in the buffer.)

Currently defined flags include:

GVF_GLOBAL_ONLY
tries to get a global env variable.
GVF_LOCAL_ONLY
tries to get a local variable.
GVF_BINARY_VAR
don't stop at n
GVF_DONT_NULL_TERM
no null termination (only valid for binary variables).

The default is to try to get a local variable first, then to try to get a global environment variable.

See also

SetVar

  

Sets a local or environment variable

DeleteVar

  

Deletes a local or environment variable

FindVar

  

Finds a local variable


Documentation generated on: 2021-07-30