Home > Net >  scanning in specific word from a file
scanning in specific word from a file

Time:11-18

I have this file called pageRankList that contains url, number of outgoing links, page rank in that order. if I want to get the pageRank of a given URL. How could I do this with fscanf or other functions?

url23 4 0.0405449
url31 3 0.0371111
url22 5 0.0300785
url34 4 0.0288782
url21 2 0.0247087
url11 3 0.0235192
url32 2 0.0227647

this is what I have so far but when I run it gives me a SEGV on unknown address error and I can't figure out why :(

static double getPageRank(char *url) {
    double pageRank = 0;
    FILE *fp = fopen("pageRankList.txt", "r");
    char str[1000];

    int counter = 0;
    while (fscanf(fp, "            
  • Related