[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[octave 2.1] fopen & reading 8 bit chars...
From: |
John W. Eaton |
Subject: |
[octave 2.1] fopen & reading 8 bit chars... |
Date: |
Fri, 29 Apr 2005 17:41:17 -0400 |
On 29-Apr-2005, fred wrote:
| Since dev release (works fine with 2.0.*), I have a problem with this
| minimal octave script, reading accented character :
|
| marsu[pts/2]:~/tmp/{41}/> cat essai.m
| function essai()
|
| file = fopen("essai.txt","rt");
| s = fgets(file)
| foo = sscanf(s, "un ?t? : %d")
|
| endfunction
|
| address@hidden:~/tmp/{1}/> essai
| s = un ?t? : 1
|
| foo = [](0x1)
Please try the following patch.
| Is it a known bug ? Or is there a trick to do ?
In the future, if you think you have found a bug in Octave, please
submit a *complete* bug report to the address@hidden list. If you're
not sure what to include so that someone can fix the problem, please
read http://www.octave.org/bugs.html before sending your report.
Thanks,
jwe
src/ChangeLog:
2005-04-29 John W. Eaton <address@hidden>
* oct-stream.cc (DO_LITERAL_CONVERSION): Cast fmt[i] to unsigned
char for comparison.
Index: src/oct-stream.cc
===================================================================
RCS file: /usr/local/cvsroot/octave/src/oct-stream.cc,v
retrieving revision 1.110.2.5
diff -u -r1.110.2.5 oct-stream.cc
--- src/oct-stream.cc 26 Apr 2005 19:43:58 -0000 1.110.2.5
+++ src/oct-stream.cc 29 Apr 2005 21:39:04 -0000
@@ -1411,7 +1411,7 @@
\
while (i < n && is && (c = is.get ()) != EOF) \
{ \
- if (c == fmt[i]) \
+ if (c == static_cast<unsigned char> (fmt[i])) \
{ \
i++; \
continue; \
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------