This post was deleted by Reddit.
5
Using fscanf to read strings line by line into an array
Post Body
Hello! I am attempting to fill an array with strings from a .txt document that are separated by lines. This is what I have so far in my function:
int i, j;
for (i = 0; i < MAX_LINES; i ) {
for (j = 0; j < MAX_LENGTH; j ) {
fscanf(keywordsFile, "%[^\n]", &keywordsArray[j][i]);
}
}
printf("%s", keywordsArray);
fclose(keywordsFile);
}
This is a small piece of my code, hopefully it will do. In this, it is only taking the first word of the .txt file and storing it in the array. But I need all the words to compare them to another .txt file. How would I go about this? Thank you for any help!
Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
4,978
Link Karma
3,334
Comment Karma
1,459
Profile updated: 1 day ago
Posts updated: 3 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/cprogrammin...