X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Fri, 19 Jul 2013 22:36:29 -0400 Message-Id: <201307200236.r6K2aTB4028844@envy.delorie.com> From: DJ Delorie To: djgpp AT delorie DOT com In-reply-to: <36bd3498-4176-4ff5-ab3c-bb5ac9653073@googlegroups.com> (fredrik DOT hultin AT gmail DOT com) Subject: Re: read() from a file descriptor returns wrong length if file contains 0x1a anywhere References: <36bd3498-4176-4ff5-ab3c-bb5ac9653073 AT googlegroups DOT com> Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 0x1f is the EOF marker for DOS text files. If you want a binary read, open the file in binary mode ;-) int fd = open("test.tst", O_RDONLY | O_BINARY, 0);