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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Carriage Returns

  • 02-04-2007 7:52pm
    #1
    Registered Users, Registered Users 2 Posts: 7,541 ✭✭✭


    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, Registered Users 2 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, Registered Users 2 Posts: 7,541 ✭✭✭irlrobins


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


  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    Silly question what language\tech?


  • Registered Users, Registered Users 2 Posts: 7,541 ✭✭✭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, Registered Users 2 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, Registered Users 2 Posts: 7,541 ✭✭✭irlrobins


    Thanks Gadget, jEdit does it for me.


Advertisement