when I complile this program and then try to run it I get error LNK1201. So I started over and left it complile to c:\ and when I try to run it I get file could not be opened. I think the objective is to compile on c:\ and save data file on a:\. what am I doing wrong? thx
#include <fstream.h>
#include <stdlib.h>
#include <iostream.h>
int main()
{
char filename[20] = "a:\filename.dat";
char data[20];
cout << "Enter the filename: " ;
cin >> filename;
cout << endl << endl;
ofstream outfile;
outfile.open(filename);
if (outfile.fail())
{
cout << "The file was not successfully opened" << endl;
exit(1);
}
cout << "Input name: ";
cin >> data;
cout << endl;
outfile<<data;
outfile.close();
return 0;
}