Advertisement Jump to content
Sign in to follow this  
sipickles

Cstring is horrid to me!

This topic is 4901 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!