octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #54622] test importdata fails in dev octave wi


From: Rik
Subject: [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows
Date: Thu, 6 Sep 2018 14:53:01 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #14, bug #54622 (project octave):

Just a thought, the creation of the file is done with binary mode, despite the
fact that this is a text file.  The code is

fn  = tempname ();
fid = fopen (fn, "w");
fputs (fid, "3.1\tInf\tNA\n-Inf\tNaN\t128");
fclose (fid);


According to the documentation for fopen,


     Append a "t" to the mode string to open the file in text mode or a
     "b" to open in binary mode.  On Windows systems, text mode reading
     and writing automatically converts linefeeds to the appropriate
     line end character for the system (carriage-return linefeed on
     Windows).  The default when no mode is specified is binary.


There is an embedded newline '\n' in there which on Linux, in binary mode, is
fine because that is the line-ending character.  On Windows, however, this
probably fails to create a 2-line file.  Maybe try altering the BIST test to


fid = fopen (fn, "wt");


and see if things work.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54622>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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