Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Carriage Returns

Options
  • 02-04-2007 8:52pm
    #1
    Registered Users Posts: 7,544 ✭✭✭


    Anyone know of a way of view the carriage returns of a text file? i.e. to determine if it has a unix style line break or a DOS one? Thanks

    R


Comments

  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Hmm when I open the file in notepad and see if its blocks..

    But isnt the windows default CrLf and Unix is CR?


  • Registered Users Posts: 7,544 ✭✭✭irlrobins


    yep, and i want to be able to determine if a file has one or the other


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Pseudo
    If InStr(CR) && (!InStr(CrLF) or !inStr(LF)) then
       nix
    Else
       doze
    end if
    

    Very rough code honest.. i shouldnt be watching tv while thinking in pseudo


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Silly question what language\tech?


  • Registered Users Posts: 7,544 ✭✭✭irlrobins


    Well I was thinking of an application rather than any particular language. Something that would allow me to see the (ASCII?) actual characters.


  • Advertisement
  • Registered Users Posts: 1,393 ✭✭✭Inspector Gadget


    Most decent editors will tell you this, I think - I know that both UltraEdit and jEdit put this in their status bars. Otherwise, assuming you're using something more sophisticated than notepad, the following guide may be useful:

    \r\n (i.e. ASCII 13/xD, ASCII 10/xA, or CR, LF) means DOS/Windows;
    \n (i.e. ASCII 10/xA, LF) indicates Unix (and possibly Mac OS X, not certain)
    \r (i.e. ASCII 13/xD, CR) on its own indicates Mac (at least, System 9 and earlier)

    CR = Carriage Return
    LF = Line Feed

    (a hangover from the old days of teletypes, this stuff)

    Hope this helps,
    Gadget


  • Registered Users Posts: 7,544 ✭✭✭irlrobins


    Thanks Gadget, jEdit does it for me.


Advertisement