I have given the file from which it should read. And as it encounters *
symbol it should update with the next member of the structure.The input file is provided here below.
*1234567890*2223334445*santoshkumar.c.*5/13,bangalore,karnataka*
0987654321*6665554447*nirmal*13/5,bangalore,karnataka*
#define N 5
struct data{
char userid[10];
char cardid[10];
char name[30];
char address[100];
};
int main(){
struct data input[N];
FILE *fp;
fp=fopen("input.txt","r");
if(fp==NULL)
{
printf("file open failed \n");
return -1;
}
for(i=0;i<N;i++){
fscanf("%s*%s*%s*%s*%s",&input.userid[i],&input.cardid[i],&input.name[i],&input.address[i]);
}
for(i=0;i<N;i++){
printf("%s%s%s%s%s",input.userid[i],input.cardid[i],input.name[i],input.address[i]);
}
fclose(fp);
}