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: anonymous
Subject: [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file
Date: Wed, 15 Mar 2023 14:33:47 -0400 (EDT)

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

                 Summary: Binary fwrite writes incorrect data to file
                   Group: GNU Octave
               Submitter: None
               Submitted: Wed 15 Mar 2023 06:33:45 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 8.1.0
         Discussion Lock: Any
        Operating System: Microsoft Windows
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Wed 15 Mar 2023 06:33:45 PM UTC By: Anonymous
If you open a file for binary write and use fwrite write a vector of uint8
values to the file, some of them get changed.  Specifically, writing hex A7
ends up in the file as hex 3F...

Here's a short script that generates incorrect results...


val = hex2dec('a7');
a = ones(2400,1)*val;
f = fopen('a.a','wb');
fwrite(f,a,'uint8');
fclose(f);

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

a(1)
b(1)









    _______________________________________________________

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]