Jump to content
  • Advertisement
Sign in to follow this  
sipickles

Cstring is horrid to me!

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am really going round the bend with Cstrings, and char*. I'm trying to lose the char*'s. But when I do a statement like Cstring* strTest("test!!"); I get an error error C2059: syntax error : 'string' I have this constructor in my Cstring class: inline Cstring::Cstring(tchar* c) { assign(c); } So why the error? all looks very straight forward to me!! Please save me!

Share this post


Link to post
Share on other sites
Advertisement
This line:
Cstring* strTest("test!!");

Declares a Cstring pointer and tries to initialize it with "test!!". This probably isn't what you want. You probably want either

Cstring strTest("test!!");

or

Cstring * strTest = new Cstring("test!!");

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!