read-line easy. To be portable over Unix and Windows, an additional option is required.
(read-line (current-input-port) 'any)
Return and line feed characters are detected after conversions that are automatically performed when reading a file in text mode. For example, reading a file in text mode on Windows automatically changes return-linefeed to line feed. Thus, when a file is opened in text mode, line-to-line is usually the corresponding line of read mode.
So, "anyone should be portable if the input port is not a file (standard input).
Testing program:
On Windows, replace (read-line (current-input-port) 'any) with (read-line) and see what happens.
source share