[Top][All Lists]

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

Re: Reading to end-of-file (fgetl.m)

From: John Eaton
Subject: Re: Reading to end-of-file (fgetl.m)
Date: Wed, 6 Sep 1995 15:53:16 -0500

Eyal Doron <address@hidden> wrote:

:   Kim, thanks for your file! However, the function crashes when trying 
: to read an empty line. You can fix this by adding "linestr=[];" before 
: the while loop.

I didn't see the file fgetl.m, but the functions fgetl and fgets will
both be available as built-in functions in the next release.  Then you
can write something like

  while (isstr (s = fgetl ("file")))
    printf ("%s\n", s);

to read all the lines from a file.  No error message will be printed
when the end of the file is reached.

You will also be able to limit the number of characters that are read
by adding a second parameter to fgetl/fgets.  For example,

  while (isstr (s = fgetl ("file", 10)))
    printf ("%s\n", s);

reads the password file in chunks of at most 10 characters.

And no, I don't have a date set for 1.2, but I'm working on it.  Also,
I don't plan to make a 1.1.2 release because it would take too much
time away from working on 1.2.



reply via email to

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