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, 11:40 PM   #3 (permalink)
Encryptic
Sleep Deprived Developer
iPhone Dev SDK Supporter
 
Join Date: Jul 2008
Location: NH
Age: 25
Posts: 68
Default

Quote:
Originally Posted by urip View Post
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
One quick thing to try, it sounds like
Code:
[NSData initWithContentsOfFile:path]
may be better to use, but I haven't tested it.
__________________
My Website: http://codeforyou.com/ Discussing anything iPhone, Programming, or just anything interesting.

Last edited by Encryptic; 06-30-2009 at 11:42 PM.
Encryptic is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,838
Threads: 89,209
Posts: 380,644
Top Poster: BrianSlick (7,129)
Welcome to our newest member, hariky007
Powered by vBadvanced CMPS v3.1.0

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