Jul 31, 2012 at 3:52am Jul 31, 2012 at 3:52am UTC
name.open (Dname".zip" );
This is no good. Ofsteam needs a cstring. It can either be in the full form "some_string" or it might be a std::string with a .c_std() method.
Like:
string std;
name.open(std.c_std());
Jul 31, 2012 at 4:13am Jul 31, 2012 at 4:13am UTC
@IceThatJaw ,
I'm sorry to ask this, but isn't supposed to be .c_str()
?
Jul 31, 2012 at 7:36am Jul 31, 2012 at 7:36am UTC
Um how do i make a zip extension? Also when i copy and paste to the console window it competently ignores the spaces and everything after it.Please help.
Jul 31, 2012 at 7:46am Jul 31, 2012 at 7:46am UTC
After you've read in the name of the file, you can use std::string's append() method to add ".zip". Then send Dname.c_str() to the filestream.
Jul 31, 2012 at 8:02am Jul 31, 2012 at 8:02am UTC
If you don't want to change Dname you can do
name.open((Dname + ".zip" ).c_str());
If you are using C++11 it's enough to do
name.open(Dname + ".zip" );
Jul 31, 2012 at 8:08am Jul 31, 2012 at 8:08am UTC
@IceThatJaw,
I'm sorry to ask this, but isn't supposed to be .c_str()?
Don't ask this, just correct me and move on.
I was close enough, right? haha
Last edited on Jul 31, 2012 at 8:09am Jul 31, 2012 at 8:09am UTC
Jul 31, 2012 at 8:13am Jul 31, 2012 at 8:13am UTC
@Peter87
C:\Users\Ultimax\Desktop\Cbr convert\CBR Convert.cpp||In function `int main()':|
C:\Users\Ultimax\Desktop\Cbr convert\CBR Convert.cpp|18|error: 'struct std::string' has no member named 'open'|
||=== Build finished: 1 errors, 0 warnings ===|
Last edited on Jul 31, 2012 at 8:14am Jul 31, 2012 at 8:14am UTC
Aug 1, 2012 at 12:28am Aug 1, 2012 at 12:28am UTC
Right, it's because open is a member of ofstream and not string.