Getbuff Command
Obsolete
The GetBuff command is obsolete. See the Struct command for creating and using structured types in DataFlex. GetBuff is not needed when using structs instead of Types.
See Also: - Getbuff_String - Field - Put_String - Type - End_Type
Purpose
To return the value of an integer from a string field.
Syntax
Getbuff From {buffer} At {field}
To {variable}
Argument Explanation
- iBuffer: The name of the complex data structure containing the field.
- iField: The name of the field whose value is to be moved to the variable.
- variable: Receiving variable.
What It Does
Getbuff retrieves the value of an integer field of a complex data structure. See the Field command for an example that uses the Getbuff command to retrieve the baud rate.
Example
This simple example demonstrates the use of Getbuff to retrieve the version number of Windows:
External_Function GetVersionEx "GetVersionExA" KERNEL32.DLL ;
Pointer lpVersionInformation Returns Integer
Type _OSVERSIONINFO
Field dwOSVersionInfoSize As dWord
Field dwMajorVersion As dWord
Field dwMinorVersion As dWord
Field dwBuildNumber As dWord
Field dwPlatformId As dWord
Field szCSDVersion As Char 128
End_Type
Procedure DoSomething
String sVersionInfo sDescription
Pointer pVersionInfo
Integer bTest iSize iMajorVersionNo
// Initialize buffer. _OSVERSIONINFO_SIZE is generated by
// the Type/End_Type command automatically.
Move (Repeat(Character(0), _OSVERSIONINFO_SIZE)) to sVersionInfo
Put _OSVERSIONINFO_SIZE to sVersionInfo At dwOSVersionInfoSize
GetAddress Of sVersionInfo to pVersionInfo
Move (GetVersionEx(pVersionInfo)) to bTest
GetBuff From sVersionInfo At dwMajorVersion To iMajorVersionNo
Showln "Major Version Number: " iMajorVersionNo
End_Procedure