Jayson Davis wrote On 06/30/06 12:43,:
Thanks for the reply. I'm taking a summer course in C and this is all a
tad overwhelming having it shoved into such a short timespan.
The string as read is "Needle\n\n", but what the string really needs to
be is "Needle\x0A0\x0A" in order for strstr() or strcmp() to work. In
other words, the string is literal "\n" and not '\n'.
Aha! I think I may have (*may* have) figured out
your difficulty. When you say the string as read is
"Needle\n\n", do you mean that there are ten characters
before the zero, the last four of which are "backslash,
n, backslash, n?" And that what you want is an eight-
character string ending in "newline, newline?"
If so, then no: There is nothing in the Standard
library that duplicates the operation of the C compiler
in translating escape sequences to characters. Those
escape sequences are a convention used only (as far as
C itself is concerned) in C source code, and the special
handling given to them by the compiler is not part of
the run-time library.
Your program, it seems, wants to use a similar
convention to represent "difficult" characters. If
that's what you're after, you'll need to write your
own translation code. Depending on how many of the C
source forms you decide to accept, the size of this
project could be anywhere from trivial to smallish.