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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-30-2009, 09:36 PM   #1 (permalink)
urip
Registered Member
 
Join Date: Aug 2008
Posts: 20
Question loading bytes from file

I'm experiencing some weird problem.
I've created a file, 2400 bytes long. Each bit in those bytes represents a (white/black) pixel.
I load the file like this:
Code:
NSData *data = [NSData dataWithContentsOfFile:path];
Byte *byteData = (Byte*)malloc([data length]);
memcpy(byteData, [data bytes], i);
but for some reason, the bytes are scrambled... I can't really identify the pattern of that disruption.
I've created the file in windows using C# and wrote it into a file using File.WriteAllBytes(). I analyzed it using C# too, and it was OK there.
Any ideas why it isn't OK in Objective C/Mac? Is there a difference in the way Mac and Windows read bytes?
or maybe NSData inserts some of its own bytes into the file's bytes?

thanks
urip is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,675
Threads: 89,155
Posts: 380,387
Top Poster: BrianSlick (7,110)
Welcome to our newest member, iTeam4apple
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:55 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.