Accessing 8-bit bytes from a file using Cocoa
Accessing 8-bit bytes from a file using Cocoa
- Subject: Accessing 8-bit bytes from a file using Cocoa
- From: Phil Faber <email@hidden>
- Date: Mon, 1 May 2006 13:17:27 +0100
Hi.
I want to be able to read from any file type (.txt, .doc, .xls, etc)
one 'literal byte' (that is, a string of eight ones-and-zeros) at a
time. The file could be any size. For each byte I want to be able
to get the actual ASCII value of that byte (a number from zero to
255). (I know that some data has to be represented by one, two or
four bytes but I am particularly interested in accessing each 8-bit
byte one at a time.)
At the moment, I'm using C coding:
(fread(&oneByte,1,1,fp1) [where oneByte is defined as a 'char']
..to read in each byte but:
(a) this only works for basic ASCII characters (for example, "A"
appears as ASCII 65) but not non-standard characters (for example,
"å" appears as ASCII -116 ... yes, MINUS 116)
(b) I suspect that it is better to achieve this task with Cocoa
instead of C.
Can anyone please provide me with the most basic coding to achieve
this in Cocoa?
Thank you.
Phil _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden