
Originally Posted by
Kinto
Well so far i'm getting the output I was expecting. I thought about using a string but felt more comfortable using char[]. I need more practice with string as I moved from C to C++.
Yes, because std::string is much harder to work with, right?
Code:
int main( void )
{
std::string
txt;
txt = "foo";
txt += "bar";
if( txt == "foobar" )
/* do something*/;
return 0;
}
Versus:
Code:
int main( void )
{
char
txt[ 1024 ];
strncpy( txt, "foo", sizeof str );
strncat( txt, "bar", sizeof str );
if( strncmp( txt, "foobar", sizeof str ) == 0 )
/* do something*/;
return 0;
}