i am new to programming, and i was making a program in which i made the user enter the name of file and then i want to move the file (into a folder known as item) . how should i do this ? i have tried to use the rename function but i am unable to do it.
string name;
int passcode;
int accnumber;
clrscr ();
system("title Stock Management Program (Creating an account) ");
cout << "Enter Name:" ; // getting basic info
cin >> name;
cout << endl;
cout <<"Enter Account Number:";
cin >> accnumber;
cout << endl;
cout << "Enter your passcode (only numbers):";
cin >> passcode;
ifstream errcheck;
errcheck.open(name);
if (errcheck.fail())
{
ofstream createacc; // creating account using fstream
createacc.open (name);
createacc << accnumber << endl;
createacc << passcode << endl;
createacc.close ();
string newname = "item\" + name; //problem
int rename ( const char * name, const char * newname ); // PROBLEM
}
{
cout << "Sorry account already exists! ";
pause ();
}