• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSMutableData not playing ball
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMutableData not playing ball


  • Subject: NSMutableData not playing ball
  • From: Nicholas Shanks <email@hidden>
  • Date: Tue, 12 Feb 2002 22:16:55 +0000
  • Resent-date: Wed, 13 Feb 2002 22:46:44 +0000
  • Resent-from: Nicholas Shanks <email@hidden>
  • Resent-message-id: <email@hidden>
  • Resent-to: email@hidden (Apple Cocoa Dev)

I have a data object with some bytes in it, such as:

ABCDEFGHIJKLMNOPQRSTUVWXYZ

and I want to replace a range of characters, say { 6, 5 } with an NSString,
say @"XYZ", thus producing the output:

ABCDEXYZKLMNOPQRSTUVWXYZ

so that now the letters FGHIJ have been replaced by XYZ. My problem is that -replaceBytesInRange:withBytes: has no idea how large the string I'm passing in is, so just replaces five bytes with five bytes, giving XYZ and two random bytes, whatever happened to be next in memory. I could do with a -replaceBytesInRange:withData: method!

How am i supposed to do this?

(note I am doing the NSString -> char* thing, but left it out of the description for simplicity)

Nicholas Shanks
--

http://nickshanks.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: prepareSavePanel and Hide extension
  • Next by Date: generate NSColorWell
  • Previous by thread: prepareSavePanel and Hide extension
  • Next by thread: Re: NSMutableData not playing ball
  • Index(es):
    • Date
    • Thread