Re: need help with string
sprintf would be one way.
Re: need help with string
would this work:
sprintf(name,"%d",dir+i+ext);
Re: need help with string
are you using C or C++??
In C++ you would use std::string and stringstreams.
In C you would use char* and sprintf. sprintf is pretty similar to printf except it prints to an area in memory and not the screen. If that sprintf were a printf, do you think it would print on the screen what you want?
Re: need help with string
Quote:
Originally Posted by
justin1232
would this work:
sprintf(name,"%d",dir+i+ext);
No.
Re: need help with string
im using c++ and i have no clue on how to do this.
Re: need help with string
the c++ way
Code:
#include <string>
#include <sstream>
template< class Type >
std::string ToString( Type Input )
{
std::stringstream Out;
Out << Input;
return Out.str();
}
using namespace std;
string File = ToString( Dir ) + ToString( I ) + ToString( Ext );
Re: need help with string
that part works, but how do i convert "file" to a const char* string so the function thats using it can understand it?
Re: need help with string
File.c_str();
http://www.cplusplus.com/reference/string/string/
is this function yours? if so, you should change it to
void Input( const string& File );