Hi all,

What is the best way to read a binary file byte by byte?
    
    
    import os, streams
    
    var fs_pos = 0
    var fs = newFileStream(paramStr(1), fmRead)
    
    while true:
      var one_char = fs.readChar()
      echo one_char
      if (one_char == '\0'):
        echo "breaking at " & $fs_pos
        break
      fs_pos += 1
    
    
    Run

streams.readChar() returns the same '0' for a null byte as well as EOF. Please 
advise.

Reply via email to