Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / August 2003



Tip: Looking for answers? Try searching our database.

Backslash in the string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Balcer - 28 Aug 2003 14:15 GMT
Hello,
I cannot compile this:
unsigned char myChars[]= "?|\+*";
The compiler (CW8.3) complanis about illegar character constant. OK I understand
this. So I changed it to:
unsigned char myChars[]= "?|\\+*";
thinking that \\ will be changed to \
but after preprocessing I see that there are two \\ in the myChars array. I want
one!
Can anyone give me a clue how to place a backslash into the string?

TIA,
Michau
David Phillip Oster - 28 Aug 2003 15:36 GMT
> unsigned char myChars[]= "?|\\+*";
> thinking that \\ will be changed to \
> but after preprocessing I see that there are two \\ in the myChars array. I
> want one!

You are right, it is just that the tool you are using to look at the
string is drawing the backslash doubled. to see this, look at

myChars[3]. It should be '+'.
Miro Jurisic - 28 Aug 2003 17:42 GMT
> I cannot compile this:
> unsigned char myChars[]= "?|\+*";
> The compiler (CW8.3) complanis about illegar character constant. OK I
> understand this.

You can? I can't. What you have above should compile just fine, and it does.

meeroh

Signature

If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.