gives me error
main
/*
The purpose of this lab is to open a text file and then make
a copy of it
*/
#include <iostream>
#include <fstream>
#include "Interface.h"
using namespace std;
int main()
{
//open up file to be read from
string input;
ifstream in;
cout<<"enter file name which needs to be opened\n";
cin>>input;
in.open(input.c_str());
while(!in)
{
in.close();
cout<<"the input textfile failed please reenter the file\n";
in.clear();
cin>>input;
in.open(input.c_str());
}
cout<<"the file opened\n";
//open up file to copy to
string output;
ofstream out;
cout<<"enter file name which to copy to\n";
cin>>output;
out.open(output.c_str());
while(!out)
{
out.close();
cout<<"output file opening failed. Please reenter output file name\n";
out.clear();
cin>>output;
out.open(output.c_str());
}
copyname a;
//read in data
a.readinput(in);
// use f.getline for Cstring and >> for rest...
return 0;
}
interface
#ifndef INTERFACE_H_INCLUDED
#define INTERFACE_H_INCLUDED
#include <iostream>
using namespace std;
class copyname
{
public:
void readinput(ifstream& input);
};
#endif // INTERFACE_H_INCLUDED
implementation
#include "Interface.h"
#include <fstream>
void readinput(ifstream& input)
{
string name;
getline(input,name);
cout<<name;
}
error in main not sure why though i declare a class than try to call the function.