SCL Reference: read() Function

The SCL read() function is an overloaded routine, meaning it can accept different parameter lists for different kinds of input (e.g. a string or a file).

This version parses a value from a string.

read(inStr,        // String to parse
     result)       // variable to receive newly parsed value

This version also parses a value from a string, but returns a status.

read(inStr,        // String to parse
     result,       // variable to receive newly parsed value
     status)       // boolean, true if parse was successful

This version reads a word value from a text file.

read(fileVar,      // file variable of file to be read
     location)     // sfr or shared location to receive value

inStr is the string variable to be parsed. Typically the string was read from an input file. Parsing occurs from left to right in the string. Note that after the call to read(), the parsed value will be removed from the string.

result is a variable that receives the parsed value. The variable can be of type integer, string, or time. The format of the string token varies based on type.

"FF 03E 25"                 // typical integer tokens
"typical string tokens"     // typcial string tokens
"10 ms 20 us"               // typcial time tokens

location is a Special Function Register or shared location to receive the newly read value.

status is a boolean variable containing read operation status. If true, the read operation succeeded.

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.