Reading data from text file in C
Posted
by themake
on Stack Overflow
See other posts from Stack Overflow
or by themake
Published on 2010-03-31T21:33:32Z
Indexed on
2010/03/31
21:43 UTC
Read the original article
Hit count: 241
I have a text file which contains words separated by space. I want to take each word from the file and store it. So i have opened the file but am unsure how to assign the word to a char.
FILE *fp;
fp = fopen("file.txt", "r");
//then i want
char one = the first word in the file
char two = the second word in the file
© Stack Overflow or respective owner