I am trying to read a .dcr binary file. We have used this script for this function many times before and it has worked well. This specific .dcr file is giving us trouble.
I open the file using fopen, then run the fread command to read the bits.
A = fread(fid,1,'long');
A =
-1
When does fread return a negative number? It should be reading 32 bits of zeros and ones. What bit does it read as the sign? or does it indicate a different error?

댓글 수: 1

Ameer Hamza
Ameer Hamza 2020년 10월 7일
'long' indicates a signed integer. Why do you expect it to not be negative? If it is unsigned, then use 'ulong'.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2020년 10월 7일

0 개 추천

Since 'long' indicates a 32-bit signed integer, and you are returning 1 value, that is likely what the function is reading.
That is what I would assume.

카테고리

도움말 센터File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2020년 10월 7일

답변:

2020년 10월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by