dimanche 28 juin 2015

Save lines from file into new string. C

I need to save lines from a text file into a string and then insert them into a data structure, but with my solution (which I assume is really bad) - I only save words into my line.

    FILE * ifile = fopen("input.txt", "r");
    char line[256];

    while(fscanf(ifile, "%s\n", line) == 1) {
        //inserting "line" into data structure here - no problem with that one
   }

Aucun commentaire:

Enregistrer un commentaire