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

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

[Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to


From: Dmitri A. Sergatskov
Subject: [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file
Date: Sat, 1 Apr 2023 13:31:41 -0400 (EDT)

Follow-up Comment #57, bug #63931 (project octave):

I fails for me 

$ hg id
ce64ec8fe929+ (stable)
[dima@ryzen clang_gopt]$ grep 'std::ostream ' 
../libinterp/corefcn/pr-output.cc
  std::ostream *osp = os.output_stream ();
$ ./run-octave -qf
octave:1> t1
val = 193
cw = 1
cr1 = 0
x = 193
error: b(1): out of bound 0 (dimensions are 0x0)
error: called from
    t1 at line 15 column 5
octave:2> t2
val = 127
cw = 1
cr1 = 1
x = 127
y = 127
------
val = 128
cw = 1
cr1 = 0
x = 128
error: b(1): out of bound 0 (dimensions are 0x0)
error: called from
    t2 at line 15 column 5
octave:3> t10
val = 1
ans = 1
<... deleted ...>
ans = 127
val = 128
ans = 128
ans = 63
error: ASSERT errors for:  assert (a (1),uint8 (b (1)))

  Location  |  Observed  |  Expected  |  Reason
     ()          128           63        Abs err 65 exceeds tol 0 by 6e+01
octave:4> val = hex2dec('a7');
a = ones(2400,1)*val;
f = fopen('a.a','wb', 'n', 'Windows-1252');
fwrite(f,a,'uint8');
fclose(f);

f = fopen('a.a','rb');
b = fread(f,2400,'uint8');
fclose(f);

a(1)
b(1)
ans = 167
ans = 63
octave:14> 


t1.m t2.m t10.m are attached
This is on linux

Only patch from this bug report ug63931-do-not-convert-bytes.patch was
applied

Dmitri.
-- 




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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