#include <stdio.h>
#include <stdlib.h>
#define SIZE 100
static int i=0;
struct Contact
{
char First[SIZE];
char Last[SIZE];
char Address[SIZE];
char City[SIZE];
char Phone[SIZE];
};
struct Contact Entry[SIZE];
int main()
{
Welcome();
return 0;
}
void Welcome()
{
int operation;
printf(" 1)Load text file. \n 2)Search for a contact. \n 3)Add new contact. \n 4)Delete a contact. \n 5)Modify a contact \n 6)Print the contact list. \n 7)Save. \n 8)Quit. \n");
printf(" \n Enter the no of operation you want to do : \n");
scanf("%d",&operation);
switch(operation)
{
case 1:
Load();
Print1();
break;
}
}
void Load()
{
char path[SIZE];
printf("Enter the path of the file : \n");
scanf("%s",path);
FILE *open;
open = fopen(path,"r");
if (open != NULL)
{
printf("File is found !\n");
while(!(feof(open)))
{
fscanf(open,"%[^,]s,%[^,]s,%[^,]s,%[^,]s,%[^,]s",Entry[i].First,Entry[i].Last,Entry[i].Address,Entry[i].City,Entry[i].Phone);
i++;
}
}
else
{
printf("File is not found \n ");
}
fclose(open);
}
void Print1()
{
int j;
for(j=0;j<i;j++)
{
printf("%s , %s , %s , %s , %s",Entry[j].First,Entry[j].Last,Entry[j].Address,Entry[j].City,Entry[j].Phone);
}
}
What is the error in this program ??