[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Unidentified subject!
From: |
John W. Eaton |
Subject: |
Unidentified subject! |
Date: |
Wed, 20 Jan 1999 12:06:45 -0600 (CST) |
On 20-Jan-1999, sini youcef <address@hidden> wrote:
| I am using octave and I am quitre disapointed that fscanf
| can not behave like matlab's fscanf in the case of reading short ints
|
| In effect the behaviour for the following instructions :
| fid = fopen('num.txt','r');
| f = fscnf(fid,'%hi');
|
| does not lead to read short ints if num.txt is :
| 0x8888
| 0x1234
|
| We should get
| f = [
| -30584
| 4660
| ]
|
| and not
|
| f = [
| 34952
| 4660
| ]
Please try the following patch. Also, please report bugs to
address@hidden
Thanks,
jwe
Wed Jan 20 12:01:14 1999 John W. Eaton <address@hidden>
* oct-stream.cc (octave_base_stream::do_scanf): Handle short and
long ints correctly.
*** src/oct-stream.cc~ Tue Aug 18 16:39:09 1998
--- src/oct-stream.cc Wed Jan 20 12:00:49 1999
***************
*** 294,300 ****
break;
case 'h': case 'l': case 'L':
- // We accept these but we don't actually use them.
if (modifier != '\0')
nconv = -1;
else
--- 294,299 ----
***************
*** 932,937 ****
--- 931,944 ----
do_scanf_conv (istream&, const char*, int*, Matrix&, double*, int&,
int, int, bool);
+ template void
+ do_scanf_conv (istream&, const char*, long int*, Matrix&, double*, int&,
+ int, int, bool);
+
+ template void
+ do_scanf_conv (istream&, const char*, short int*, Matrix&, double*, int&,
+ int, int, bool);
+
#if 0
template void
do_scanf_conv (istream&, const char*, float*, Matrix&, double*, int&,
***************
*** 1038,1047 ****
case 'd': case 'i': case 'o': case 'u': case 'x':
{
! int tmp;
! do_scanf_conv (is, fmt, &tmp, mval, data, count,
! nr, max_size, discard);
}
break;
--- 1045,1076 ----
case 'd': case 'i': case 'o': case 'u': case 'x':
{
! switch (elt->modifier)
! {
! case 'h':
! {
! short int tmp;
! do_scanf_conv (is, fmt, &tmp, mval, data, count,
! nr, max_size, discard);
! }
! break;
!
! case 'l':
! {
! long int tmp;
! do_scanf_conv (is, fmt, &tmp, mval, data, count,
! nr, max_size, discard);
! }
! break;
! default:
! {
! int tmp;
! do_scanf_conv (is, fmt, &tmp, mval, data, count,
! nr, max_size, discard);
! }
! break;
! }
}
break;