# Problem with strings

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

## Recommended Posts

I've been working on an awesomium app, and have run into a bit of a problem with strings.
Here's an example
int currentconfig = configsHandle->currentConfig;
char gamedir[260];
//_snprintf(gamedir, sizeof(gamedir),"$('#gamedata0').val('%s');",configsHandle->m_Configs[currentconfig]->m_gamedir); _snprintf(gamedir, sizeof(gamedir),"$('#gamedata0').val('%s');","f:\\\\what\\\\the\\\\f#$&.fgd"); //printf("the gamedir is: %s\n",gamedir); MessageBoxA(0,gamedir,"message",MB_OK); caller->ExecuteJavascript(WSLit(gamedir),WSLit(""));  My problem is this, f:\\\\what\\\\the\\\\f#$&.fgd evaluates to f:\\what\\the\\f#$&.fgd for the messagebox, while on the html element #gamedata0 it shows up as f:\what\the\f#$&.fgd

How would i go about getting configsHandle->m_Configs[currentconfig]->m_gamedir converted to something that will show up correctly in the html?

##### Share on other sites

Since 4 slashes translates to 2 in what looks like C (or C++), and then translates to 1 in HTML, perhaps it is because storing in gamedir stores 2 slashes next to each other instead of 4 because the slash is an escape character, and when passed along, it looks like second escape set, so it escapes it again.

\\\\ -> \\
\\ -> \

##### Share on other sites
Thanks, that verifies what I was thinking. Earlier this morning I figured that I should use a function to replace all "\\" with "\\\\". A quick google search came up with this http://stackoverflow.com/questions/779875/what-is-the-function-to-replace-string-in-c and it worked perfectly Edited by Chris528