Re: Cocoa equivalent to fputc()?
Re: Cocoa equivalent to fputc()?
- Subject: Re: Cocoa equivalent to fputc()?
- From: John Stiles <email@hidden>
- Date: Tue, 05 Sep 2006 07:45:41 -0700
PS It looks like CFData will be fairly efficient in this case; it will
round up the allocation size to the nearest power of two when growing
its buffer, so appending bytes will happen in amortized constant time.
John Stiles wrote:
I think the moral equivalent of fputc would be
char c = whatever;
[myMutableData appendBytes:&c length:sizeof(char)];
Doesn't seem all that fussy to me.
I don't know if it will be /efficient/ though. I don't know if
NSMutableData is optimized for appending data one byte at a time. (I
guess you could check out the CFData source :) )
Chris Ryan wrote:
Looking at NSMutableData's appendBytes:length: method, which seems a
little fussy in terms of creating buffers etc. [1]. Am I looking in
the wrong place? Is there a better/easier class or way to work with a
mutable data object?
[1]
http://developer.apple.com/documentation/Cocoa/Conceptual/BinaryData/Tasks/WorkingMutableData.html
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden