Can't type ten steenking lines without a glaring bug...

Blair P. Houghton bhoughto at nevin.intel.com
Fri Apr 5 14:25:50 AEST 1991


In article <3661 at inews.intel.com> bhoughto at hopi.intel.com (Blair P. Houghton, simpering, compiler-wastrel, code-anal weenie) writes:
>	stat( "filename", &stb );
>	buf = (char *) malloc ( stb.st_size * (sizeof (char *)) );
>	fp = fopen( "filename", "r");
>	fread( buf, stb.st_size, 1, fp );	/* yippee! */

Of course, the second line above should be

	buf = (char *) malloc ( stb.st_size );

				--Blair
				  "I wash colored things in hot
				   water all the time, too..."



More information about the Comp.lang.c mailing list