C Programming Problem

Greg Pasquariello X1190 gpasq at picuxa.UUCP
Wed Jan 4 23:57:56 AEST 1989


In article <32229 at auc.UUCP> tab at auc.UUCP (0-Terrence Brannon ) writes:
-Ok, this is my source:
----------------------
-
-#include <stdio.h>
-
-main()
-{
-	FILE	*fp;
-	char	*a;
-	int 	i, q, r, s, t, u, v;
-		
-
-	fp = fopen("tab.dat", "r");
-	a = (char *) calloc (80, sizeof(char));
-
-	for (i=0, i < 3; ++i);
-	{
-	fscanf(fp, "%s %d %d %d %d %d %d", a, q, r, s, t, u, v);
-	printf("%s %d %d %d %d %d %d", a, q, r, s, t, u, v);
-	}
-}
-
-Any ideas why valid integers from a file can't be read in as integers but
-only can be read in a char strings?
-
-...!gatech!auc!tab

They can, but you are doing it incorrectly.  Look at the man page for fscanf, 
and you'll see that the parameters that fscanf takes are stream, format, and
_POINTER_!  You are not passing pointers to ints, you are only passing ints.

Greg
-- 
=============================================================================
Dirt is the mother o' lunch 	  	Greg Pasquariello AT&T/EDS
					att!picuxa!gpasq  
=============================================================================



More information about the Comp.lang.c mailing list