a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 dos.library
  AbortPkt
  AddBuffers
  AddDosEntry
  AddPart
  AddSegment
  AllocDosObject
  AssignAdd
  AssignLate
  AssignLock
  AssignPath
  AttemptLockDosList
  ChangeMode
  CheckSignal
  Cli
  CliInitNewcli
  CliInitRun
  Close
  CompareDates
  CreateDir
  CreateNewProc
  CreateProc
  CurrentDir
  DateStamp
  DateToStr
  Delay
  DeleteFile
  DeleteVar
  DeviceProc
  DoPkt
  DupLock
  DupLockFromFH
  EndNotify
  ErrorReport
  ExAll
  ExAllEnd
  ExNext
  Examine
  ExamineFH
  Execute
  Exit
  FGetC
  FGets
  FPutC
  FPuts
  FRead
  FWrite
  Fault
  FilePart
  FindArg
  FindCliProc
  FindDosEntry
  FindSegment
  FindVar
  Flush
  Format
  FreeArgs
  FreeDeviceProc
  FreeDosEntry
  FreeDosObject
  GetArgStr
  GetConsoleTask
  GetCurrentDirName
  GetDeviceProc
  GetFileSysTask
  GetProgramDir
  GetProgramName
  GetPrompt
  GetVar
  Info
  Inhibit
  Input
  InternalLoadSeg
  InternalUnLoadSeg
  IoErr
  IsFileSystem
  IsInteractive
  LoadSeg
  Lock
  LockDosList
  LockRecord
  LockRecords
  MakeDosEntry
  MakeLink
  MatchEnd
  MatchFirst
  MatchNext
  MatchPattern
  MatchPatternNoCase
  MaxCli
  NameFromFH
  NameFromLock
  NewLoadSeg
  NextDosEntry
  Open
  OpenFromLock
  Output
  ParentDir
  ParentOfFH
  ParsePattern
  ParsePatternNoCase
  PathPart
  PrintFault
  PutStr
  Read
  ReadArgs
  ReadItem
  ReadLink
  Relabel
  RemAssignList
  RemDosEntry
  RemSegment
  Rename
  ReplyPkt
  RunCommand
  SameDevice
  SameLock
  Seek
  SelectInput
  SelectOutput
  SendPkt
  SetArgStr
  SetComment
  SetConsoleTask
  SetCurrentDirName
  SetFileDate
  SetFileSize
  SetFileSysTask
  SetIoErr
  SetMode
  SetOwner
  SetProgramDir
  SetProgramName
  SetPrompt
  SetProtection
  SetVBuf
  SetVar
  SplitName
  StartNotify
  StrToDate
  StrToLong
  SystemTagList
  UnGetC
  UnLoadSeg
  UnLock
  UnLockDosList
  UnLockRecord
  UnLockRecords
  VFPrintf
  VFWritef
  VPrintf
  WaitForChar
  WaitPkt
  Write
  WriteChars
Include
GuruMeditation
Docs » Autodocs » dos.library » GetVar

NAME

	GetVar -- Returns the value of a local or global variable (V36)

SYNOPSIS

	len = GetVar( name, buffer, size, flags ) 
D0 D1 D2 D3 D4
LONG GetVar( STRPTR, STRPTR, LONG, ULONG )

FUNCTION

	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.)

INPUTS

	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. 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). (V37)
The default is to try to get a local variable first, then
to try to get a global environment variable.

RESULT

	len -   Size of environment variable.  -1 indicates that the
variable was not defined (if IoErr() returns
ERROR_OBJECT_NOT_FOUND - it returns ERROR_BAD_NUMBER if
you specify a size of 0). If the value would overflow
the user buffer, the buffer is truncated. The buffer
returned is null-terminated (even if GVF_BINARY_VAR is
used, unless GVF_DONT_NULL_TERM is in effect). If it
succeeds, len is the number of characters put in the buffer
(not including null termination), and IoErr() will return the
the size of the variable (regardless of buffer size).

BUGS

	LV_VAR is the only type that can be global.
Under V36, we documented (and it returned) the size of the variable,
not the number of characters transferred. For V37 this was changed
to the number of characters put in the buffer, and the total size
of the variable is put in IoErr().
GVF_DONT_NULL_TERM only works for local variables under V37. For
V39, it also works for globals.

SEE ALSO

SetVar(), DeleteVar(), FindVar(), <dos/var.h>

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Fairlight

FC
FLT
AFL
SNT

Comments:

$VER: d0.se 1.14 Copyright © 2011-2021 Tobias Geijersson support at d0 dot se