Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-09-2009, 11:29 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: Bhubaneswar(INDIA)
Posts: 39
ajitbiswal is on a distinguished road
Default NSString

getBytes:maxLength:usedLength:encodingptions:ran ge:remainingRange:


what is the use of this method... can anyone explain..The description of parameters are....

Parameters
buffer
A buffer into which to store the bytes from the receiver. The returned bytes are not NULL-terminate

maxBufferCount
The maximum number of bytes to write to buffer.
usedBufferCount
The number of bytes used from buffer. Pass NULL if you do not need this value.
encoding
The encoding to use for the returned bytes.
options
A mask to specify options to use for converting the receiver’s contents to encoding (if conversion is
necessary).
range
The range of characters in the receiver to get.
leftover
The remaining range. Pass NULL If you do not need this value.
Return Value
YES if some characters were converted, otherwise NO.
ajitbiswal is offline   Reply With Quote
Old 09-10-2009, 12:12 AM   #2 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
FlyingDiver will become famous soon enough
Default

Did you read the description in the class specification?

joe
FlyingDiver is offline   Reply With Quote
Old 09-10-2009, 12:23 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: Bhubaneswar(INDIA)
Posts: 39
ajitbiswal is on a distinguished road
Default

Quote:
Originally Posted by FlyingDiver View Post
Did you read the description in the class specification?

joe
i am not getting you....sorry for this... please explain me...
ajitbiswal is offline   Reply With Quote
Old 09-10-2009, 12:26 AM   #4 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
FlyingDiver will become famous soon enough
Default

I asked, did you read the documentation?

It's used to convert an NSString to an array of bytes.

joe
FlyingDiver is offline   Reply With Quote
Old 09-10-2009, 12:38 AM   #5 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: Bhubaneswar(INDIA)
Posts: 39
ajitbiswal is on a distinguished road
Default

Quote:
Originally Posted by FlyingDiver View Post
I asked, did you read the documentation?

It's used to convert an NSString to an array of bytes.

joe
I understand this but the buffer(max,used) and receiver range concept confusing me..
ajitbiswal is offline   Reply With Quote
Old 09-10-2009, 12:42 AM   #6 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
FlyingDiver will become famous soon enough
Default

Quote:
Originally Posted by ajitbiswal View Post
I understand this but the buffer(max,used) and receiver range concept confusing me..
Max is to tell the NSString object how long the array is that's available to hold the converted string. Used is for the NSString to tell you how much of the buffer it actually used. Range is so you can specify what part of the NSString you want converted to bytes.

You could have been a little more specific in your original question.

The docs actually do say all this.

joe
FlyingDiver is offline   Reply With Quote
Old 09-10-2009, 12:55 AM   #7 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: Bhubaneswar(INDIA)
Posts: 39
ajitbiswal is on a distinguished road
Default

Quote:
Originally Posted by FlyingDiver View Post
Max is to tell the NSString object how long the array is that's available to hold the converted string. Used is for the NSString to tell you how much of the buffer it actually used. Range is so you can specify what part of the NSString you want converted to bytes.

You could have been a little more specific in your original question.

The docs actually do say all this.

joe

You have mention that in max part we have to give the max size of buffer and in range part the no of character to be converted.In used buffer part we have to give the buffer size to be used for the above characters but matter is that how can we know how much size it going occupy in buffer..
ajitbiswal is offline   Reply With Quote
Old 09-10-2009, 12:59 AM   #8 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
FlyingDiver will become famous soon enough
Default

Quote:
Originally Posted by ajitbiswal View Post
You have mention that in max part we have to give the max size of buffer and in range part the no of character to be converted.In used buffer part we have to give the buffer size to be used for the above characters but matter is that how can we know how much size it going occupy in buffer..
No, read the API section again:

Code:
The number of bytes used from buffer. Pass NULL if you do not need this value.
The NSString sets that variable to the number of bytes actually used. You have to pass in a pointer to a variable there. If you don't care how many it actually used, then pass in NULL.

joe
FlyingDiver is offline   Reply With Quote
Old 09-10-2009, 01:17 AM   #9 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: Bhubaneswar(INDIA)
Posts: 39
ajitbiswal is on a distinguished road
Default

Quote:
Originally Posted by FlyingDiver View Post
No, read the API section again:

Code:
The number of bytes used from buffer. Pass NULL if you do not need this value.
The NSString sets that variable to the number of bytes actually used. You have to pass in a pointer to a variable there. If you don't care how many it actually used, then pass in NULL.

joe

Please give me one example....
ajitbiswal is offline   Reply With Quote
Old 09-10-2009, 10:46 PM   #10 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: Bhubaneswar(INDIA)
Posts: 39
ajitbiswal is on a distinguished road
Default

I am new to this language so it is very difficult for me to understand thats why i was asking for example... please give me example.... I have asked to complete all the functions in a specified time....thank u for making me understand the concept...
ajitbiswal is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting 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



» Advertisements
» Online Users: 457
13 members and 444 guests
Domele, Duncan C, Feldspar, MacBook MH, Objective Zero, patapple, peterwilli, pipposanta, PixelInteractive, Punkjumper, SLIC, taylor202, Today's Posts
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,694
Threads: 94,137
Posts: 402,950
Top Poster: BrianSlick (7,990)
Welcome to our newest member, peterwilli
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:03 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0