Date: Thu, 8 Nov 2001 20:04:18 +0100 (MET) From: Gisle Vanem To: djgpp AT delorie DOT com Subject: Re: Can't Even Read File Correctly In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie 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 On Thu, 8 Nov 2001, Robert Neinast wrote: > while ((c=getchar())!=EOF) > { > putc(c, fp); > } > $ nnn < nnn.exe > $ ls -l > -rw-r--r-- 1 dosuser root 296 Nov 8 12:40 nnn.c > -rwxr-xr-x 1 dosuser root 111608 Nov 8 12:54 nnn.exe > -rwxr-xr-x 1 dosuser root 432 Nov 8 12:54 xx.aa > > So, why is it truncated so??? Probably because there is a ^Z (ASCII 26) in the input stream. AFAICR, stdin must be set to binary mode to prevent truncating. Gisle V.