Menu

#414 Int 21h/AH=0Ah "Buffered Input" doesn't filter out linefeeds

SVN
open
nobody
None
1
2015-04-21
2015-04-21
No

I have a file on my computer that uses CRLF line endings. I mount the directory containing this file as a drive in DOSBox. Then I run a program and redirect stdin from this file. The program reads using Int 21h with AH=0Ah. The first line reads correctly. Everything up to the CR is read and returned to the calling program. However when reading the next line, the LF comes back from the fread() call and is put into the beginning of the buffer before the rest of the line. This confuses the program which is not expecting LF characters in the buffer.

I think LF should be filtered out somewhere but I don't know where the correct place for this is. I've tried adding a simple "if (c == 10) continue;" to the for loop in the handler for 0x0A in DOS_21Handler and this solves the problem for me.

Discussion


Log in to post a comment.