.Modelica.Utilities.Streams.readLine

Information

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.

Interface

impure function readLine
  extends Modelica.Icons.Function;
  input String fileName "Name of the file that shall be read" annotation(
    Dialog(loadSelector(filter = "Text files (*.txt)", caption = "Open text file for reading")));
  input Integer lineNumber(min = 1) "Number of line to read";
  output String string "Line of text";
  output Boolean endOfFile "If true, end-of-file was reached when trying to read line";
end readLine;

Generated at 2024-12-24T19:25:53Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos