public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Rupert Wood" <me@rupey.net>
To: <kabir.patel@uk.andersen.com>
Cc: <gcc-help@gcc.gnu.org>
Subject: RE: Control M ????
Date: Tue, 12 Feb 2002 05:14:00 -0000	[thread overview]
Message-ID: <616BE6A276E3714788D2AC35C40CD18D03AA30@whale.softwire.co.uk> (raw)
In-Reply-To: <616BE6A276E3714788D2AC35C40CD18D3F2CB8@whale.softwire.co.uk>

Kabir Patel wrote:

> Some time back I mentioned a problem I had with the ^M character
> (see below). It so happens that I need to be able to replace every
> ^M in my resultant file with a " " charachter. GNU isn't happy with
> ^M. Is there a way to define ^M in another way?

Yes, this is exactly the problem you had before.

^M is ASCII 13, representing carriage return (CR); hence you could
replace the single character constant '^M' with any of the following:

    13
    '\x0d' (backslash x zero d: 0d is hexadecimal for 13)
    '\r'

(or the octal string escape represntation, or hex or octal immediates,
etc.)

The last is a special C-escape for CR and perhaps the most useful
representation since it describes the intended meaning here. (On the
other hand, this might not be appropriate if you're specifically dealing
with PC text files guaranteed to be 13-10 and the host system's CR might
not be 13 or something - I guess it's a style call.)

If you have ^M in the middle of a string then you should replace it with
a string constant escape such the latter two, \x0d or \r.

Rup.

       reply	other threads:[~2002-02-12 12:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <616BE6A276E3714788D2AC35C40CD18D3F2CB8@whale.softwire.co.uk>
2002-02-12  5:14 ` Rupert Wood [this message]
2002-02-12 13:11 Josh Perlmutter
2002-02-12 16:31 ` Andrea 'Fyre Wyzard' Bocci
  -- strict thread matches above, loose matches on Subject: below --
2002-02-12  4:30 kabir.patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=616BE6A276E3714788D2AC35C40CD18D03AA30@whale.softwire.co.uk \
    --to=me@rupey.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=kabir.patel@uk.andersen.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).