Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to get a word from file c++

void readFile()
{
    ifstream file;
    file.open ("program.txt");
    if (!file.is_open()) return;

    string word;
    while (file >> word)
    {
        cout<< word << '
';
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #word #file
ADD COMMENT
Topic
Name
6+3 =