13.07.2015 Views

Macro Guide - Esker

Macro Guide - Esker

Macro Guide - Esker

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GetVariable typesThe type of the variable parameter determines how data will be read from the file. It can be any ofthe following types:Variable TypeIntegerLongString (variable-length)File Storage Description2 bytes are read from the file.4 bytes are read from the file.In binary files, variable-length strings are read by first determining thespecified string variable's length and then reading that many bytesfrom the file. For example, to read a string of eight characters:s$=String$(8,"")Get#1,,s$String (fixed-length)DoubleSingleDateBooleanVariantUser-defined typesArraysObjectIn random files, variable-length strings are read by first reading a 2-byte length and then reading that many characters from the file.Fixed-length strings are read by reading a fixed number of charactersfrom the file equal to the string's declared length.8 bytes are read from the file (IEEE format).4 bytes are read from the file (IEEE format).8 bytes are read from the file (IEEE double format).2 bytes are read from the file. Nonzero values are True, and zero valuesare False.A 2-byte VarType is read from the file, which determines the format ofthe data that follows. Once the VarType is known, the data is read individually,as described above. With user-defined errors, after the 2-byteVarType, a 2-byte unsigned integer is read and assigned as the value ofthe user-defined error, followed by 2 additional bytes of informationabout the error. The exception is with strings, which are always precededby a 2-byte string length.Each member of a user-defined data type is read individually. In binaryfiles, variable-length strings within user-defined types are read by firstreading a 2-byte length followed by the string's content. This storage isdifferent from variable-length strings outside of user-defined types.When reading user-defined types, the record length must be greaterthan or equal to the combined size of each element within the datatype.Arrays cannot be read from a file using the Get statement.Object variables cannot be read from a file using the Get statement.ExampleSub MainOpen "test.dat" For Random Access Write As #1For x = 1 to 10280

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!