I am programing in MFC .NET, and I am encountering a problum in adding the symbol '\' to a CString object. This is naturaly due to the fact that the symbol is used for such things as \n \t ect.

How do I go about it?

say I have the following code:

CString word="hello world";
word+="\"; // or "'\'" doesn't work...

Cheers,
Hike

Recommended Answers

All 2 Replies

Another reply solue due to the fact that goole desktop for some reason wants to propagate these questions now and then...

I wanna say RTFM, but I can include the escape the escape hint... Use \\ for a literar \ in C/C++/Java/(Just about any other application that uses \ escapes for special characters).

/pern.*/i

I am programing in MFC .NET, and I am encountering a problum in adding the symbol '\' to a CString object. This is naturaly due to the fact that the symbol is used for such things as \n \t ect.

How do I go about it?

say I have the following code:

CString word="hello world";
word+="\"; // or "'\'" doesn't work...

Cheers,
Hike

*********************************************************

I think you could do it this way
word+=_T("\");

Nkamanyi Clement

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.