dos to unix CR/LF conversion?
Henry Spencer
henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org
Sun Nov 9 22:12:35 UTC 2003
On Sun, 9 Nov 2003, James McIntosh wrote:
> >> You should indicate you're using octal for \012.
> >The backslash-digits notation is always octal. However, I should have
> >mentioned that, for the benefit of newcomers.
>
> When the backslash is followed immediately by zero, then it is octal.
> When the backslash is followed immediately by a digit other than zero, or a
> letter A to F, or a to f, then it is hexadecimal.
Not in C it's not, nor in most of the other Unix/Linux languages.
Backslash followed by digits is *always* octal, no exceptions. To
get hex, e.g. hex "ae", you have to say "\xae".
> For example:
> \070 is octal.
Correct.
> \70 is hexadecimal
Nope. C printf("\070 \70\n") prints "8 8".
> \ae is hexadecimal
> \AE is hexadecimal
Nope. The first is \a ("audible alert", ASCII BEL) followed by 'e'; the
second gives a compiler warning message ("unknown escape sequence") and
prints an 'A' and an 'E'.
> \2B is hexadecimal
Nope, it's a \002 -- ASCII STX, ^B -- followed by a 'B'.
Henry Spencer
henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list