Code: Select all
Structure FileDef
op.l
hFile.l
dataptr.l
datalen.l
keyptr.l
keylen.l
keyno.l
EndStructure
OpenResult.lCode: Select all
Structure FileDef
op.l
hFile.l
dataptr.l
datalen.l
keyptr.l
keylen.l
keyno.l
EndStructure
OpenResult.lTo declare a variable in PureBasic, simply type its name. You can also specify the type you want this variable to be. Variables do not need to be explicitly declared, as they can be used as "variables on-the-fly". The 'DefType' keyword can be used to declare multiple variables in one statement.
Example :
a.b ; Declare a variable called 'a' from byte (.b) type.
c.l = a*d.w ; 'd' is declared here within the expression !
Basic types
PureBasic allows type variables. Theses types are signed and can be standard integers, floats numbers or even string characters. Here is the list of the native supported types and a brief description :
Name Extension Memory consumption Range
Byte .b 1 byte in memory -128 to +127
Word .w 2 bytes in memory -32768 to +32767
Long .l 4 bytes in memory -2147483648 to +2147483647
Float .f 4 bytes in memory unlimited (see below)
String .s length of the string + 1 Up to 65536 characters