Re: String Character Conversion
- From: Jack Klein <jackklein@xxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 11:52:30 -0500
On Fri, 30 Jun 2006 15:46:10 GMT, Jayson Davis
<eclecticboxers@xxxxxxxxx> wrote in comp.lang.c:
Say I have a string read from a configuration file.
searchfor <tab> Needle\n\n
Where I want to search for the word "Needle" with two linefeeds. Now
when I read it from the file, it hasn't converted the linefeeds into
characters. Is there a function to do that or do I need to write it myself?
Your question is not clear. What do you mean by "it"? What "it"
hasn't converted the linefeeds into characters? Everything you can
ever read from any file is composed of characters.
Do you mean that, on a single line read from a text file, you
literally have the four characters '\', 'n', '\', 'n' as the last four
text characters before the end of the line?
If that's what you mean, you will need to interpret the meaning in
your program. The mapping of escape sequences like \n, \t, \b, and so
on, in string literals and character constants, to single characters
is a feature of the compiler and performed when translating the source
code at compile time. There is nothing in the standard library that
does this translation for you at run time.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.
- References:
- String Character Conversion
- From: Jayson Davis
- String Character Conversion
- Prev by Date: Re: Safe use of unions
- Next by Date: Re: Need help to save strings from a file to a structure
- Previous by thread: Re: String Character Conversion
- Next by thread: Application Reading Itself
- Index(es):
Relevant Pages
|