I'm trying to strcpy a string file a file to the program; whats wrong with this?
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <stdio>
using namespace std;
int main () {
string line;
string copy;
ifstream myfile ("C:\\Documents and Settings\\Rpg\\Desktop\\C++\\example.txt");
if (myfile.is_open())
{
while (! myfile.eof() )
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
strcpy(copy,line);
cout<< "\n" << copy;
system("pause");
return 0;
}