peaseblossom
IS-IT--Management
Hi: a real newbie trying to write a utility that copies a file from 1 directory to another; I get a lot of error messages
#include <fstream>
#include <ios>
#include <iostream>
using std::cout;
int main() {
const char* from = "cod.fil";
std::string dir ("/home/Dad/hello/cut/");
const char* to ="12345";
std::string dest = dir + to;
std::ifstream infile(from, std::ios_base::binary);
std:fstream outfile(dest, std::ios_base::binary);
outfile << infile.rdbuf();
cout<< dest;
}
The issue appears to revolve around the variable 'dest'in the ofstream line.'to' works. Could anybody advise where I am going wrong - and how to resolve? I have 4 manuals c++ manuals and they have yet to help!
Thanks!
#include <fstream>
#include <ios>
#include <iostream>
using std::cout;
int main() {
const char* from = "cod.fil";
std::string dir ("/home/Dad/hello/cut/");
const char* to ="12345";
std::string dest = dir + to;
std::ifstream infile(from, std::ios_base::binary);
std:fstream outfile(dest, std::ios_base::binary);
outfile << infile.rdbuf();
cout<< dest;
}
The issue appears to revolve around the variable 'dest'in the ofstream line.'to' works. Could anybody advise where I am going wrong - and how to resolve? I have 4 manuals c++ manuals and they have yet to help!
Thanks!