help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to read txt file and output to display


From: Andrew Janke
Subject: Re: How to read txt file and output to display
Date: Thu, 14 Mar 2019 17:04:57 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.3



On 3/14/19 4:30 PM, sb wrote:
I have a txt file which includes a help text for a program that I am trying
to write.
I want to display its contents to the display (i.e. read from txt file and
flush its content to the display) when selected from a menu.
I couldn't find the exact command to do this (if any)?
Most of the commands refer to reading data with delimiters. I want to read
from a simple txt file which includes text (any length and any number of
lines).
Is this possible?


Sure. Use fopen() with fgetl() or fgets() to read the text from the file, collect those in a cellstr, and then print them using fprintf(). The "line-oriented input" functions are the family you need to read plain text. See https://octave.org/doc/v4.4.1/Line_002dOriented-Input.html.

Cheers,
Andrew



reply via email to

[Prev in Thread] Current Thread [Next in Thread]