pure functionpureReadLine
Read a line of text from a file and return it in a string
Extends from Modelica.Icons.Function (Icon for functions).
Information
This function implements
Modelica.Utilities.Streams.readLine
but declares it as a pure function, which is fine assuming a user is
not deliberately changing the file after the model is translated.
Syntax
(string, endOfFile) = Streams.readLine(fileName, lineNumber)
Description
Function readLine(..) opens the given file, reads enough of the content to get the requested line, and returns the line as a string. Lines are separated by LF or CR-LF; the returned string does not contain the line separator. The file might remain open after the call.
If lineNumber > countLines(fileName), an empty string is returned and endOfFile=true. Otherwise endOfFile=false.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | fileName | Name of the file that shall be read | |
| Integer | lineNumber | Number of line to read |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | string | Line of text | |
| Boolean | endOfFile | If true, end-of-file was reached when trying to read line |