CLEAR will reset a static variable to NULLs. This is useful for cleaning unwanted characters from strings that are being manipulated by binary access such as Random Access data.
Syntax:CLEAR(StaticVariable) Parameters:
|
TYPE DATAREC FName [10] AS CHAR Age AS INTEGER END TYPE DIM i AS UINT64 DIM Datar AS DATAREC Datar.FName$ = "BCX CLEAR" Datar.Age% = 65534 FOR i = 0 TO SIZEOF(Datar.FName)-1 PRINT ASC(&Datar.FName[i]); NEXT i PRINT "" CLEAR(Datar.FName$) FOR i = 0 TO SIZEOF(Datar.FName)-1 PRINT ASC(&Datar.FName[i]); NEXT i PRINT "" PRINT Datar.Age% CLEAR(Datar.Age%) PRINT Datar.Age%
66 67 88 32 67 76 69 65 82 0 0 0 0 0 0 0 0 0 0 0 65534 0
👉 The CLEAR command cannot be used with dynamic strings.
To clear a dynamic string, use the C function memset, for example,
memset(TheDynamicString, 0, MEMSIZE(MyString))