Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created August 16, 2011 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piscisaureus/1149564 to your computer and use it in GitHub Desktop.
Save piscisaureus/1149564 to your computer and use it in GitHub Desktop.
Dealing with stdio
1. figure out the type of stdio handle
2. use it
* Windows
+ console handle -> ReadConsoleInput / WriteConsoleOutput. Captures keystrokes.
+ (blocking) named pipe -> ReadFile / WriteFile in a thread.
+ (blocking) file handle -> ReadFile / WriteFile in a thread.
+ (overlapped) named pipe server handle -> Igor's patch
+ other options not considered so far: socket, tcp server, overlapped file, overlapped
* Unix
+ tty -> set to nonblocking, raw mode. Decode vt100, emit keystrokes.
+ file -> use libeio
+ pipe / socket -> set to nonblocking mode. Attach to uv_tcp / uv_pipe handle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment