DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   ANSI string problem (http://www.daniweb.com/forums/thread15811.html)

1o0oBhP Dec 19th, 2004 12:05 pm
ANSI string problem
 
I am used to using:

char *str;

to make a string but recently have changed to using the ANSI string class as its a lot more powerful and easier to use... BUT i have a problem!

when I have encountered a string which conatins a " character I have used the following for a c-style string

char *str = 'quote = "hello"';
Which means it will contain "quote = "hello""
However i have a line of code which is

string str = '<tr><td><img src="log_error.bmp"></td><td><b>';
but it gives an error. It seems like the new ANSI string wont accept the ' character. Does anyone know how i can write that string to include the " characters around the bmp filename?

vegaseat Dec 19th, 2004 12:33 pm
Re: ANSI string problem
 
You inspired me to add one more item to my code snippet on std::string ...
[php] // use \" for embedded double quotes
string s1 = "<tr><td><img src=\"log_error.bmp\"></td><td><b>";
cout << s1 << endl << endl;
[/php]

1o0oBhP Dec 19th, 2004 12:37 pm
Re: ANSI string problem
 
ahh thanks. This means i could add a snippet too!! i have a logging system that makes a html file with icons for each type of entry (its normal, its a warning, its an error ect...) its all tabulated as well :)


All times are GMT -4. The time now is 7:35 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC