delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/11/08/14:09:45

Date: Thu, 8 Nov 2001 20:04:18 +0100 (MET)
From: Gisle Vanem <giva AT bgnett DOT no>
To: djgpp AT delorie DOT com
Subject: Re: Can't Even Read File Correctly
In-Reply-To: <MPG.165491792e225e13989690@netnews.worldnet.att.net>
Message-ID: <Pine.UW2.3.95.1011108200204.2061A-100000@bryggen.bgnett.no>
MIME-Version: 1.0
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

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019