do not fclose stdin or stdout. accept 0 count to read entire file.