Omg, it's been a while: fstream help pls.
// Read an entire file into a single string
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
void main() {
ifstream in("FillString.cpp");
string s, line;
while(getline(in, line))
s += line + "\n";
cout << s;
}
This program works. But when running in VC++ 6 IDE the console doesn't show the contents of the FillString.cpp file.
BUt when executed by the exe, it does, though I have to insert cin.get() at the end.
Q1:
Why doesn't the output show in the IDE?
Q2:
cin.get() is ugly.
What was the other method to hold the console, only waiting for a button to close? I totally forgot.
Thx in advance,
Val
|