Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve readChar #191

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

privat
Copy link
Contributor

@privat privat commented Aug 7, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant