I believe i am wrong in the two red points...is it right? also whats the problem?
thanks in advance....
Code:#include <stdio.h> #include <stdlib.h> #include <string.h> struct Info{ char name[81]; int phone; char street[81]; char email[81]; }; void print(struct Info info.name, struct Info info.phone, struct Info info.street, struct Info info.email){ printf("Name: %s\n", info.name); printf("Phone Number: %d\n", info.phone); printf("Street address: %s\n", info.street); printf("E-mail: %s\n", info.email); } int main(void){ FILE *infile; struct Info info; infile = fopen("file.txt","r"); if(infile==NULL){ printf("Error :(\n"); exit(1); } while(fscanf(infile,"%s %d %s %s", info.name, &info.phone, info.street, info.email)!=EOF){ print(info.name, info.phone, info.street, info.email); } return 0; }



LinkBack URL
About LinkBacks



