tags:

views:

311

answers:

2

Could you please tell me how can one escape an apostrophe.

I need it to process non apostrophe characters through file operations so when I encounter an apostrophe(') I can't just give ch!='''. It doesn't work. Could you please tell me the right format. Thank you..:)

+9  A: 

You can escape a single quote as

'\''

for example

while(*p && *p != '\'') p++;

This is an escape sequence; the backslash tells the compiler that following ' normal character, and not as one of the single quotes that you surround a character with.

Daniel LeCheminant
*"next character is to be treated as a normal character"* ... that could be read as `\0` becoming `0` and ignores octal and hex numbers.
Georg Fritzsche
Right, but I'm talking about the specific escape sequence `\'` ... I'm not trying to imply that all escape sequences are a given length.
Daniel LeCheminant
Thought so, just wanted to point out the possible misunderstanding.
Georg Fritzsche
+5  A: 

use

if ( ch != '\'' )

\' is an escape sequence for apostrophie.. google for "escapesequence" to know abt it more..

echo
to help u more : http://msdn.microsoft.com/en-us/library/h21280bw(VS.80).aspx
echo
Hi..:) thank you for your answer.. Just saw ur blog.. even I am from ase, ase-bang
mgj