I have a text file that has some ascii art in it, and I was wondering if there is any way to just print the contents into the console, it is in a txt file.
Open a command window, change directory to where you believe your file is located (use 'help cd' if you can't manage this), enter dir
to check that it is there, and then enter type ascii_art.txt
(obviously changing the designated file to whatever yours is called.)
I'm on a Mac (don't know if this changes anything)
But when I type type boar.txt
I get -bash: type: boar.txt: not found
And I am in the file where it is.
> For large files, could rdbuf fail where another method such as while (getline(f, line)) { cout << line << "\n";} would otherwise still work?
No. The steam buffer (in this case std::filebuf) handles buffering automatically.
When an attempt is made to read one or more characters from the stream buffer, and the input buffer is exhausted ( gptr() == egptr() ), the stream buffer would first call uflow().