TC bugs

Yijun Ding ydist at unix.cis.pitt.edu
Wed Sep 5 11:59:20 AEST 1990


I recently got the patch files for TC 2.0 from simtel20. 
This cleard some entries from my TC-bug-list.  The following
program demonstrates other two possible bugs.  The first is
definitely a bug.  When compiled on unix system, it print 3.14e...
instead of 3.1e...    The second, I am not sure.  The "a+" format
does not allow write to the beginning of files in TC.  On unix,
the printout is "isis is a ..." instead of "This is a..." on TC.
Any comments?

#include <stdio.h>
#include <math.h>

FILE *fi;
char buf[]="This is a test.\n";

main()
{
	/* e-format precision incorrect */
	printf("%5.2e\n", 3.141596);

	/* a+ can't write over */
	fi = fopen("tmp.doc", "a+");
	fwrite(buf, sizeof(buf), 1, fi);
	fseek(fi, 0L, 0);
	fwrite(buf+2, 2, 1, fi);
	fseek(fi, 0L, 0);
	fread(buf, sizeof(buf), 1, fi);
	printf(buf);
	getchar();
}



More information about the Comp.lang.c mailing list