ANSI string problem

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

ANSI string problem

 
0
  #1
Dec 19th, 2004
I am used to using:

  1. 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

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

  1. 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?
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 3,954
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 917
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: ANSI string problem

 
0
  #2
Dec 19th, 2004
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]
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: ANSI string problem

 
0
  #3
Dec 19th, 2004
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
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC