CString to std::string question

I have to convert code from MFC to standart C++.

It used to be:
time_t lTime;
CString time, tmp;
time(&lTime);
time= "time:";
tmp.Format("%ld", lTime);
time += tmp;


But now I have changed it to:
time(&lTime);
std::string time;
char szTmp[20];
sprintf(szTmp,"%ld", lTime);
time += szTmp;


Can any one see any problems with this? Any other suggestions??

Thanks





This is the problem with using the std::string library. It doesn't think in real world situations for fast programming and the real nature of C++'s Encapsulations.

MFC had its quirks and bonuses. One you speak of. The only way I got around this was writing my own string class to think like I did. I need to advance it so it can handle wide strings and advanced ansi strings. I didn't base it off of std::string. Standard library has a lot of code just to do simple things and they call this the fastest way to do things.

Just food for thought.
Topic archived. No new replies allowed.