fgetl() on Windows

John W. Eaton jwe at octave.org
Mon May 11 11:51:16 CDT 2009


On 11-May-2009, AlexG1 wrote:

| I'm having some trouble using the fgetl() function on a Windows system. 
| Every line in a Windows file ends with <cr><lf>. While fgetl() ignores the
| <lf> character it doesn't ignore <cr> (unlike the Matlab version of the same
| function), which can be problematic in some cases (e.g. when I'm reading a
| file path and then try to use fopen() on it - I get fid = -1).
| 
| Is there a function which ignores <cr> completely, or should I shorten every
| line that is read by 1 character?

What version of Octave?  As I recall, this problem was fixed some time
ago.  It seems to work correctly for me wiht 3.0.5 on a Debian system
reading files with CRLF line endings.

jwe


More information about the Help-octave mailing list