Gold mine of Visual C++ tricks!
Archive for June 1, 2008
How to include special characters in string?
Jun 1st
![]()
In C++ programs, sometimes you’ve to add special chars to your strings. For instance a copyright message – “Copyright © WeSeeTips.com”. If your editor like Visual Studio support unicode, you can directly paste it to the source. But not all editors are unicode aware. So what’s the safest method?
![]()
You can use C++ escape sequence – \x. The \x followed by hexadecimal value of char will insert that char to the string. For instance the hex of © is oxA9. See how it can be added to a string.
// 0xA9 is the hex for copyright symbol.
const TCHAR* pCopyright = _T("Copyright \xA9 WeSeeTips.com");
AfxMessageBox( pCopyright );
![]()
Its worth reading about trigraphs chars at this moment.
http://weseetips.com/2008/03/25/trigraph-char-sequences-in-c-c/
![]()
Targeted Audience – Beginners.

