This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fwrite inconsistency


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@adtech-inc.com     Adtech, Inc.    (808) 734-3300

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]