[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #50297] csv2cell does not ignore CR in CRLF fi
From: |
Philip Nienhuis |
Subject: |
[Octave-bug-tracker] [bug #50297] csv2cell does not ignore CR in CRLF files |
Date: |
Tue, 14 Feb 2017 15:40:12 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 |
Follow-up Comment #1, bug #50297 (project octave):
What io package release?
On Windows, with this script:
fid = fopen ('a_CRLF.csv', 'w')
fprintf (fid, "a\r\n1\r\n");
fclose (fid)
fid = fopen ('a_CRLF.csv', 'r')
txt = fread (fid, Inf, "char=>char")'
fclose (fid)
uint16(txt)
a = csv2cell ('a_CRLF.csv')
uint16(a{1})
uint16(a{2})
I get:
>> format compact
>> fid = fopen ('a_CRLF.csv', 'w')
fid = 3
>> fprintf (fid, "a\r\n1\r\n");
>> fclose (fid)
ans = 0
>> fid = fopen ('a_CRLF.csv', 'r')
fid = 3
>> txt = fread (fid, Inf, "char=>char")'
txt = a
1
>> fclose (fid)
ans = 0
>> uint16(txt)
ans =
97 13 10 49 13 10
>> a = csv2cell ('a_CRLF.csv')
a =
{
[1,1] = a
[2,1] = 1
}
>> uint16(a{1})
ans = 97
>> uint16(a{2})
ans = 1
>>
... so at least on Windows it appears to work properly.
So I suspect that cv2cell's sensitivity for EOL type could be OS-specific; or
more specific, the C++ function getline() that csv2cell invokes might be
OS-dependent.
But my C++ proficiency is below par so don't take my idea to seriously.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?50297>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/