Re: Look at NSData
Re: Look at NSData
- Subject: Re: Look at NSData
- From: Marco Binder <email@hidden>
- Date: Sat, 12 Apr 2003 17:57:05 +0200
Well, my guess would be that the message tells you the truth! There is
only 1 byte in myData2, therefore the index of 1 is not valid. Check
how you initialize myData2... and you should never put a hard coded
upper limit (4080) into your loop if you arnt sure how long the data
actually is...
Am Samstag, 12.04.03 um 13:10 Uhr schrieb Peter Karlsson:
myData is declared like this:
NSData *myData = [NSData dataWithContentsOfFile:thePath];
myData2 is declared like this:
NSData *myData2;
When trying this code I get a error message saying:
*** -[NSConcreteData getBytes:range:]: location 1 exceeds data length 1
// check to see if myData2 holds the right values
for (i = 0; i < 4080; i++)
{
myRange.location = i;
[myData2 getBytes:&buffer1 range:myRange];
NSLog(@"X", buffer1);
}
But looking at myData works. What's the problem here?
Peter
From: "Peter Karlsson" <email@hidden>
To: email@hidden
Subject: Look at NSData
Date: Sat, 12 Apr 2003 06:36:14 +0000
Dear list!
I have a NSData object and wonder how I can look at all the bytes
inside it with the help of NSLog?
Example: Lets say I have 1000 bytes in the NSData object and I want
to look at all the bytes in a loop, how?
Peter
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
_______________________________________________
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.
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
_______________________________________________
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.
--
|\ /| email@hidden
http://www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
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.