-
-
Save Varriount/6c20d6f47add09c694ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import strutils | |
const SIZE = 8192 | |
var | |
rlen = 0 | |
totlen = 0 | |
buf = newStringOfCap(SIZE) | |
lc = 0 | |
totlines = 0 | |
while true: | |
rlen = stdin.readBuffer(addr buf, SIZE) | |
if rlen == 0: break | |
# does not like the next line. | |
# how to make it a "string"? | |
lc = buf.countLines() | |
echo lc | |
totlines.inc(lc) | |
totlen.inc(rlen) | |
echo totlen | |
echo lc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment