CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    carriage return / line feed

    I've just joined a project that will be built for both Windows & Linux. At the moment, its source files use 'line feed' (0x0A) to indicate end-of-line. Unfortunately, if I do any editing in VC++, it does the old DOS/Windows trick of adding a carriage return, giving 0x0D, 0x0A. This seems to upset the Linux build.

    VC++ seems happy enough to read files without carriage returns - but is there a way to stop it from writing carriage returns? Alternatively, is there an alternative IDE which doesn't have that problem?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #2
    Join Date
    May 2006
    Location
    Norway
    Posts
    1,709

    Re: carriage return / line feed

    Hi John,

    Not sure I understand your problem 100%. Is your problem that every line has an 'M' appended to it when you do a linux compile?

    If so, you can use the dos2unix command to translate between ASCII CR+LF (DOS/Windows) and LF (Unix) newlines.

    Alternatively, you may have a look at this freeware editor: PSPAD A freeware code editor

    Not sure this is your problem tough!

    Regards,

    Laitinen
    Last edited by laitinen; March 16th, 2007 at 04:54 AM.

  3. #3
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: carriage return / line feed

    Hi Laitinen. Yes that's approximately it. Re-reading my post, I didn't explain it too well. Basically, what happens is that the original line feeds remain as line feeds - but any new lines that I introduce are saved with CR/LF pairs. Therefore in the finished file, some EOL's are LF only and some are CR/LF. I'll try your suggestions though.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: carriage return / line feed

    Interesting. I've been doing cross platform development for a few years now, and I've never seen this behavior (I've been using Visual Studio 6 and up).

    Viggy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured