jeudi 30 avril 2015

How do I use strtok to take in words separated by white space into a char array in C?

I have opened a file as such:

#define MAX 1000000000
char buffer[MAX];

FILE *file = fopen("sample1.txt", "r");
char c;

if(file == NULL) {
    perror("File open error");
    return -1;

Now what I want to do is that use 'strtok' and take in seperate words from the file into the char array buffer.

Aucun commentaire:

Enregistrer un commentaire