I'm in a tutorial which
introduces files (how to read and write from\to
file)
First of all, this is not a homework, this
is just general help I'm seeking.
I know how to
read one word at a time, but I don't know how to read one line at a time or how to read
the whole text file.
What if my file contains
1000 words? It is not practical to read each
word.
My text file named (Read) contains the
following:
I love to play
games
I love reading
I have 2
books
This is what I have accomplished so
far:
#include
#include
using namespace
std;
int main (){
ifstream inFile;
inFile.open("Read.txt");
inFile
>>
Is there any
possible way to read the whole file at once, instead of reading each line or each word
separate?
No comments:
Post a Comment