Reading words from file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Reading words from file

How can I read words from a specific text file in C++? I’m trying to make a program that can search for certain words in a file...

28th Feb 2018, 10:19 PM
Guada Guap
Guada Guap - avatar
1 Answer
0
#include <stdio.h> { void main(); file*fp; fp=fpopen("file name .txt","r"); if(fp=NULL) { printf(" file not found"); exit(1); } ch=fget(fp); while(!feopen(fp)) { printf("%c",ch); ch=fget(fp); } fclose(fp) getch(); }
2nd Mar 2018, 11:13 AM
GAUTAM KUMAR
GAUTAM KUMAR - avatar