Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ucsd!ncr-sd!ivory!laman From: laman@ivory.SanDiego.NCR.COM (Mike Laman) Newsgroups: comp.lang.c Subject: Re: C Programming Problem Message-ID: <632@ncr-sd.SanDiego.NCR.COM> Date: 4 Jan 89 23:16:41 GMT References: <32229@auc.UUCP> Sender: news@ncr-sd.SanDiego.NCR.COM Reply-To: laman@ivory.SanDiego.NCR.COM (Mike Laman) Distribution: na Organization: NCR Corporation, Rancho Bernardo Lines: 37 In article <32229@auc.UUCP> tab@auc.UUCP (0-Terrence Brannon ) writes: : : : >#include > >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); ^ ^ Change to ';' Remove this ';'. Now you will get 3 loop iterations. Syntax error?! I guess you typed in this one for the message. > { > fscanf(fp, "%s %d %d %d %d %d %d", a, q, r, s, t, u, v); Change this fscanf() to: fscanf(fp, "%s %d %d %d %d %d %d", a, &q, &r, &s, &t, &u, &v); You must pass the data addresses to fscanf() so it can change your data variables! The "a" variable is the address of the area; that's why "a" was proprly initialized. Next time read the manual more carefully! > printf("%s %d %d %d %d %d %d", a, q, r, s, t, u, v); > } >} Mike Laman