I'm making a program that takes the words from one text or data file and transferes it to another. there are not supposed to be any spaces in the second file. I need to know why I can't make this code work. It would not be the completed code but more like a place to start.
#include <iostream.h>
#include <fstream.h>
#include <string.h>
int main ()
{
char in;
ifstream infile;
ofstream outfile;
infile.open("in.dat",ios::in);
outfile.open("out.dat",ios::out);
if ((!infile) || (!outfile))
{
cout << "error opening file\n";
return 0;
}
do
{
infile >> in;
cout << in;
} while(!infile.eof())
infile.close ();
outfile.close ();
return 0;
}
I am having a problem with the compiler I think. When I try to build the program I get an error message that says:
syntax error : missing ';' before identifier 'infile'
but you will notice that i do have a semicolol there, right after char in;
thanx to anyone who helps