Server Help

Bot Questions - Store files in a certain dir

Witchie NL - Tue Nov 28, 2006 2:11 pm
Post subject: Store files in a certain dir
I was wondering if you can make a mervbot plugin store files in a certain directory.
The way to output data to a textfile i use now is with Streams like:
Code: Show/Hide

ofstream file("database.dat", ios::app);
if (file)
{
   file << "blabla:" << a_string.msg  << endl;
   tell(makeEcho("Database Saved.."));
}
else
{tell(makeEcho("Error Saving Database.."));}   
file.close();

This creates-edits a file in the same dir as the plugin.
But i need it to save in another directory. Like C:/MERVBot/Database instead of C:/MERVBot
Can this be done with stream´s or do i need to use another way?
If so how do you do this?
Mine GO BOOM - Tue Nov 28, 2006 3:10 pm
Post subject: Re: Store files in a certain dir
[code]ofstream file("c:\\mervbot\\database\\database.dat", ios::app);[/quote]
The double slashes is just escaping the one slash.
Witchie NL - Wed Nov 29, 2006 6:04 am
Post subject:
now i could have found out about that myself.
Ima do that. thanks.
Cyan~Fire - Wed Nov 29, 2006 10:49 am
Post subject:
Of course, to save relative to the MERVBot directory, you'd want to do "database\\database.dat". But I'm sure you could have found that our yourself too.
Witchie NL - Wed Nov 29, 2006 1:47 pm
Post subject:
ohyeah and the directory needs to be already created.
Else it will give an error and crate a blank file in the same folder as the plugin. Thanks!
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group