Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String problem

Status
Not open for further replies.

paul51

Programmer
May 19, 2000
38
0
0
US
I am trying to form the following string "****.***" (including the quotes).

CString C1 = "****.***" results in ****.*** without the quotes. I need the qoutes.
CString C1 = ""****.***"" results in a compilor error pertaining to the .* that is in the string.

Does anyone know how to for this properly?

Thanks.
 
Code:
CString C1 = "[red]\"[/red]****.***"\";
Use a back-slash to quote the few special characters.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
Mispalce the last \ Salem 8)
Code:
CString C1 = "\"****.***\"";

paul, single quote are used for 'char' type, not string, so you can only have a single char r escape character between single quotes. ex. 'a', '\013' or '\'', '\"'

Same way you can do the "\" my string with double quotes \""
or "This is my escape char for single quote quote \' "

newline and carriage returns are escape chars as well \n ans \r. which is why they have the \
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top