I have a ASCII file which I want to read byte by byte into a Byte
buffer. I am clueless and confused between many aspects. Can anyone guide me with the correct way to do it?
Any help is appreciated.
I have a ASCII file which I want to read byte by byte into a Byte
buffer. I am clueless and confused between many aspects. Can anyone guide me with the correct way to do it?
Any help is appreciated.
I finaly got the answer here. So what I did is,
NSMutableString *bundlePath = [NSMutableString stringWithString:
[[NSBundle mainBundle]pathForResource:@"excercise1" ofType:nil]];
NSData *myData = [NSData dataWithContentsOfFile:bundlePath];
uint8_t * bytePtr = (uint8_t * )[myData bytes];
NSInteger totalData = [myData length] / sizeof(uint8_t);
NSLog(@"Data byte chunk: ");
for (int i = 0 ; i < totalData; i ++)
{
NSLog(@" %x", bytePtr[i]);
}
and it worked as I wanted it to be. I got the bytes in an array.