I have to parse a text file with 3 different data types. I want it to be saved in a structure array with three members. My text file look like this:
>A B 45.78965
>A C 35.46731
>B C 46.78695
I have written a code and when I run it at the terminal, it only showed a blinking underscore then after a while the program stopped. What should I do?
#include"stdio.h"
#include"string.h"
struct gra{
char from;
char to;
double w;
};
int main(){
FILE* fp;
fp=fopen("graph.txt","r");
int i=0;
while(!feof(fp)) {
fscanf(fp,"%[^\t]",&graph[i].from,&graph[i].to,&graph[i].w);
i++;
} fclose(fp);}