Reading Data from a File

Five methods read data from a file: Get, Input, InputB, LineInputString, and InputFields.

The Get method reads a Variant variable from a file. First, it reads the two-byte Variant type, then it reads the data that goes into the variable and returns a Variant with the correct information. The Get method has a parameter you can use to specify the position to start reading the Variant type.

The Input method reads a specified number of characters from a file. Windows CE is a Unicode-based operating system, so two bytes typically are used to store each character. If the data in your file represents binary data instead of characters, you can use the corresponding InputB method, which reads single bytes instead of byte pairs.

The LineInputString method reads a string of characters from a file until it finds a carriage return character or a carriage return/line feed combination. LineInputString discards the terminating characters when it returns the string.

The InputFields method reads characters from a file and returns a Variant array with a specified number of elements. InputFields reads a stream of characters until it finds a comma character. When it finds a comma character, it determines the Variant type represented by the previous characters and stores the Variant in an array element. InputFields continues reading characters and filling array elements until the specified number of array elements has been filled.