rars icon indicating copy to clipboard operation
rars copied to clipboard

Improve readChar

Open privat opened this issue 2 years ago • 0 comments

readChar has various issues:

  • it consumes a whole line of text, truncate it at the first character and lose what remain
  • is not able to read newline character (it just aborts)
  • also aborts on EOF

This PR proposes that:

  • readChar reads the next byte in the input (run panel or stdin) and use it as the result
  • \n is not special and just return 10
  • return -1 (signed 32/64 bit) on EOF

The PR also add tests for readChar, readString and read

privat avatar Aug 07 '23 21:08 privat