• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Sequencer
  • TextFileReader

TextFileReader

TextFileReader Usage

The TextFileReader ServiceBlock can be used to read contents line-by-line from a file. Specify the FileName and trigger the file read by sending a Read event to the block. This will cause the Line contents to be emitted for each line in the file, along with the Index. If an error occurs, the Error event is emitted (with ErrorText describing the error) and further processing is aborted. When the reading is done successfully, a Done event is emitted.

Events and Arguments

The TextFileReader ServiceBlock has the following events:

NameTypeDescription
InitInputCan be used to chain Init events / prepare the system
InitedOutputCan be used to chain Init events / prepare the system
ReadInputReads line by line of data from the file in FileName, until end-of-file is reached. Each line is emitted in Line along with the Index.
LineOutputEmitted by the TextFileReader when a line has been read. The content of the line is available in TextLine
DoneOutputEmitted by the TextFileReader when file reading is complete.
ErrorOutputIf an error occurs, this Error event is emitted, and the error text can be found in ErrorText.

The following Arguments can be used to configure the TextFileReader:

Argument NameTypeValueDescription
FileNameInputRelative or full native path nameThe file name to read from, with the optional path prefix, relative to the application folder
TextLineOutputanyThe text or data that that was read from the file
ErrorTextOutputError textAn error-text as reported by the underlying operating system.
IndexOutputCurrent line index (0-based)The 0-based index of the current line emitted by Line

See also MessageArgument, ReceiveMessage, SendMessage, DebugPrinter, Basic Block, Service Blocks, and TextFileWriter.

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top