Basically, in C, there is a control character "\" which is a slash. \n is one character, \r is another, \t is a tab, etc. Now, what do you think the control character itself should be? Well typically it is "\\". But this involves some silly search-and-replacing to change "\\" to "\".
My solution is to escape the control character itself. So you say "\e" which is replaced with a "\". Now you can process the string without first replacing all the slashes. Much better - and it doesn't even take up any more space.
Friday, 15 April 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment