Thread: getting rid of the unsightly "^M" character

  1. #1
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790

    getting rid of the unsightly "^M" character

    Ok, silvercord was great in pointing me towards my old 3dmath code;however, since it was written in MSVC.NET, I have these unsightly '^M' characters at the end of each line, how can I get rid of them all in one burst?

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Write a program to do it

    Open the file, every time the character comes around kill it.

    Can't remember if its ascii 10 or 13.

  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    dos2unix filename filename

    That should do it on *nix
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    dos2unix will do it. I forgot about the differences during a programming competition last month, and ended up coming 2nd because of the initial confusion about that.

    >dos2unix filename filename
    If you leave out the 2nd 'filename', it'll just overwrite the original, FYI.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Character literals incorrectly interpreted
    By DL1 in forum C Programming
    Replies: 11
    Last Post: 04-05-2009, 05:35 PM
  2. Using a character array in a switch question.
    By bajanElf in forum C Programming
    Replies: 10
    Last Post: 11-08-2008, 08:06 AM
  3. MURK - a small preview
    By Mario F. in forum Game Programming
    Replies: 27
    Last Post: 12-18-2006, 08:22 AM
  4. How to get rid of newline character
    By C++angel in forum C++ Programming
    Replies: 3
    Last Post: 02-07-2006, 07:50 PM
  5. Replies: 12
    Last Post: 01-12-2002, 09:57 AM