whats wrong with my program

ok so I think my program can't find or create my files? im not sure. can someone please tell me whats wrong with this program

#include <iostream>
#include <fstream>
using namespace std;

int main()
{
ifstream infile;
ofstream outfile;
float one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve;
infile.open("C:\\temp.dat");
if (!infile)
{
cout<<"File is not there\n";
exit(0);
}
outfile.open("C:\\tempdata.dat");
if (!outfile)
{
cout<<"File cannot be created\n";
exit(0);
}

infile >> one >> two >> three >> four >> five >> six >> seven >> eight >> nine >> ten >> eleven >> twelve;



outfile << one << endl << two << endl << three << endl << four << endl << five << endl << six << endl << seven << endl << eight << endl << nine << endl << ten << endl << eleven << endl << twelve << endl;
infile.close();
outfile.close();
return 0;


}


it runs without any errors but when i run it it says "file cannot be created. but the file is in my C drive. what's wrong?
Do you have permission to create a file in C:\ ?
yes i do i have admin access
can anyone please help?
What is your OS, crappy vista might not let you access the root. Try putting the files in the same directory as the program.Then use a relative path (remove "C:\\")
Topic archived. No new replies allowed.