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 > CFString carriage return?

CFString carriage return?
Thread Tools
Dedicated MacNNer
Join Date: Apr 2001
Location: Columbia, MD
Status: Offline
Reply With Quote
Nov 23, 2001, 10:29 AM
 
I am trying to enter a carriage return to a CFString, but can't get it to work.

For example, if I try to append a carriage return (from a C string) to a CFString by the following line:

CFStringAppend(textOut,CFSTR("\n"));

When I display the CFString to an output window, it shows the carriage return character, instead of actually starting a new line.

Any suggestions?
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Nov 24, 2001, 03:58 AM
 
Depending where you're displaying it, you might need a \r instead of a \n
     
Dedicated MacNNer
Join Date: Apr 2001
Location: Columbia, MD
Status: Offline
Reply With Quote
Nov 24, 2001, 10:20 AM
 
The \r did it. Thanks.

By the way, what is \r? That is not listed in my elementary C book. Is it an 'advanced' C function or is it a carbon thing?
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Nov 24, 2001, 03:04 PM
 
It's Mac OS-specific, I think. It's equivalent to the return key on Macs. \n is ASCII character 10, \r is ASCII character 13.
     
Mac Enthusiast
Join Date: Sep 2001
Location: McKinney, TX
Status: Offline
Reply With Quote
Nov 26, 2001, 09:40 AM
 
"\r" is a carriage return. "\n" is a line feed, a.k.a. a newline character. In MS-DOS and Windows, both are used at the end of a line, i.e. "\r\n"; in UNIX variants, only "\n" is used; in Classic MacOS, only "\r" is used.
     
   
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 11:15 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