This is my code and I want to assign the string that I get from a file to a variable that I created as a struct.
#include <stdio.h>
#include <stdlib.h>
struct customer
{
char customer_id[100];
char service_type[100];
char total_fee[100];
};
int main()
{
struct customer cust[100];
int i;
i = 0;
char line[50];
FILE* fptr;
fptr = fopen("test.txt", "r");
while (fgets(line, 50, fptr))
{
line = cust[i].customer_id; ///String is not modifiable so this solution cannot be applied
}
}
Any solution to this problem?