delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/08/08/18:19:39

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <B9906C3F4BB3D311A60F009027463EE9B64EE7@mgmgrand.adtech-inc.com>
From: "Jimen.Ching" <JChing AT adtech-inc DOT com>
To: cygwin AT sources DOT redhat DOT com
Subject: fwrite inconsistency
Date: Tue, 8 Aug 2000 12:18:46 -1000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

------_=_NextPart_001_01C00186.9F03378C
Content-Type: text/plain;
	charset="iso-8859-1"

Hi all,

The problem below produces "0 0" as output on HPUX and Solaris 2.5 with gcc
2.8.x.  But using gcc 2.95.x on cygwin, I get "0 1".  I also tried using
Borland BCC, and I also got "0 1".  Is GCC trying to behave like MS
compilers
under cygwin?

Is it correct for size2 to contain 1?  What does ANSI/ISO say about this?

--jc
-----------------------------------------------------
#include <stdio.h>

int
main(int argc, char *argv[])
	{
	int size1, size2;
	FILE *fp;

	fp = fopen("tst.log", "w");
	size1 = fwrite(0, 1, 0, fp);
	size2 = fwrite(0, 0, 1, fp);
	printf("%d %d\n", size1, size2);

	return 0;
	}

--
jimen AT adtech-inc DOT com     Adtech, Inc.    (808) 734-3300

------_=_NextPart_001_01C00186.9F03378C--

- Raw text -


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