Hrmm... is there anyway to print more than just the first word of a text file using ifstream?
// Kavity
Hrmm... is there anyway to print more than just the first word of a text file using ifstream?
// Kavity
use getline()
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
Would you be able to give me an example? :\
// Kavity
i'm not stupid, just a little short on brains.
Kav's game!
Featuring:
# - Goodguy mc goodguy
* - Bad guy mc badguy
$ - Princess Mc Cess
@ - Mcdonalds Mc chicken! mmmmmm
Code:#include <fstream> #include <iostream> #include <string> // ... std::ifstream fin("filename.txt", std::ios::in); std::string buffer; while (std::getline(fin, buffer)) std::cout << buffer << endl;