I ran across this code and was wondering what the extra braces are there for?
Code:int main() { const int sz = 100; // Buffer size; char buf[sz]; { ifstream in("Strfile.cpp"); // Read assure(in, "Strfile.cpp"); // Verify open ofstream out("Strfile.out"); // Write assure(out, "Strfile.out"); int i = 1; // Line counter // A less-convenient approach for line input: while(in.get(buf, sz)) { in.get(); // Throw away next character (\n) cout << buf << endl; // Must add \n out << i++ << ": " << buf << endl; } } // Destructors close in & out } ///:~
It seems very odd to me but compiled fine when i removed the assure function calls. I also removed the ofstream stuff, but i think it would compile with that in there also