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: Uwe Damm
Subject: Re: How to read txt file and output to display
Date: Thu, 14 Mar 2019 21:58:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1


Am 14.03.19 um 21:30 schrieb sb:
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?



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html




fopen and fgetl should do the job (see > help fgetl)


fd=fopen('test.txt','r');

while(-1 != (a=fgetl(fd)))
    disp (a);
end
fclose(fd);




reply via email to

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