3 August 2007
Determining Line-Endings
If you need to find the line endings of a particular text file from inside a Objective-C or Cocoa application have a look the example code here:
Line-Endings Xcode Project (24kb)

Un-zip the package on you Desktop, (I have hard coded the link to the test file relative to the users desktop), open the xcode project then build and run.
The code uses a CocoaDev.com NSStringCategory method, -occurencesOfSubstring:, to find the number of line-endings in the file. The file is read using standard NSString methods, queried for the number of times the UNIX, Mac and DOS line-endings occur and the data stored. The line-endings that occur the most is thought to be representative of the whole file and returned.
If you find this useful, please post a comment. Or if you have a better way (simpler way) let me know too!


Very interesting Boyfarrell, however I have another problem, can you help please! I wish to use a Linux program on my Mac. I have a program to convert tif files to processed image stacks but it’s for Linux. Do I have to use something like Fink or am I way off?! The program is in-house, so I don’t know how to run it! Please help! Thanx. Nice songs by the way…