Hello i'm pratically a newbie to C++ i have only been programming in VB, but my problem is this: i am reading a book called "Thinking in C++" and they tell me this:
And it is suppose to copy the contents of one file into the other, and it does nothing i made the first file CoryS.cpp say "hello this is just a test" and the CoryS2.cpp a blank file with nothing in it....and it didn't work, anyoen know why/>Code:#include <string> #include <fstream> #include <iostream> using namespace std; int main() { ifstream in("CoryS.cpp"); //opening file for reading ofstream out("CoryS2.cpp"); //opening file for writing string s; while(getline(in, s)) //discards newline char out << s << "/n"; // ... must add it back }
if so please post!
Thanks for listening!





Reply With Quote