0

In C ++ there is a readRawData function that helps to read the byte stream in a file. For example:

stream->readRawData(layerName, 64);

So I have 64 bytes to read the layer name. After these 64 bytes, I want to read the name:

stream_name->readRawData(m_name, 4);

And so on, without going backwards. Is there anything similar in Python?

Holger
  • 285,553
  • 42
  • 434
  • 765
user2962768
  • 121
  • 1
  • 3
  • 10
  • 2
    What let you think that Python `read` method on a byte stream is different? – Serge Ballesta Nov 09 '21 at 15:52
  • 2
    `file = open(path, 'rb'); layer_name = file.read(64); m_name = file.read(4)`, however `read(n)` may return less than `n` bytes on EOF, you need to check `len(bytes)` of returned bytes; https://docs.python.org/3/library/functions.html#open – Ruslan Tushov Nov 09 '21 at 15:53
  • Where is `readRawData` defined? It’s not part of C++. – Konrad Rudolph Nov 09 '21 at 16:45

0 Answers0