Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > return character on os X

return character on os X
Thread Tools
Fresh-Faced Recruit
Join Date: Mar 1999
Location: Perpignan, Catalunya, France
Status: Offline
Reply With Quote
Jun 18, 2001, 11:02 AM
 
Hi.

My problem is very simple. I don't have MacOS X so I ask you :
on macos X is return character :
-> chr(13)+chr(10) (Like Windows or UNIX)
-> chr(13) (like MacOS Classic) ?

Thank you very much,
Pierre.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Jun 18, 2001, 11:56 AM
 
The Cocoa and BSD APIs use the UNIX convention, a bare linefeed only -- chr(10). I think this is the most typical case you'll find on the system, at least at the lower levels.

I'm pretty sure the Carbon APIs and Classic apps will still use the classic MacOS one, chr(13) (carriage return).

I'm not sure about things like CoreFoundation which is used by both Cocoa and Carbon, but I'm guessing it uses the UNIX-style ones too (the XML preferences files, for example).

Nothing uses the Windows convention, chr(13)+chr(10).
     
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status: Offline
Reply With Quote
Jun 18, 2001, 12:05 PM
 
FYI. In Java, you can inspect the line.separator environment variable to determine the return character(s) of the host operating system. Use this to avoid hard-coding a certain convention into your application.

<font face = "courier">String sep = System.getProperty( "line.separator" );</font>


Edit: fixed a typo.

[ 06-18-2001: Message edited by: honeydew ]
     
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status: Offline
Reply With Quote
Jun 18, 2001, 08:35 PM
 
In this day of networks and files of relatively unknown origin (PC, Mac, *nix) shouldn't we write software that doesn't make assumptions about what line break characters are used?

I mean just glancing on my directory I have multiple text files that are in all three formats. I'm just glad that my primary coding app (Vusual Studio - no jeers please) is able to deal with them all. Whenever I write my own I always assume any type might be present. (Although to be fair I use Lex a lot for translating text documents, so it is easy for me)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:21 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2