• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Accessing 8-bit bytes from a file using Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Accessing 8-bit bytes from a file using Cocoa
      • From: Sherm Pendley <email@hidden>
    • Re: Accessing 8-bit bytes from a file using Cocoa
      • From: Ricky Sharp <email@hidden>
    • Re: Accessing 8-bit bytes from a file using Cocoa
      • From: Ondra Cada <email@hidden>
    • Re: Accessing 8-bit bytes from a file using Cocoa
      • From: Nick Zitzmann <email@hidden>
    • Re: [CocoaProgrammingForAbsoluteBeginners] Accessing 8-bit bytes from a file using Cocoa
      • From: Paul Lynch <email@hidden>
  • Prev by Date: Re: NSString into *arguments[]
  • Next by Date: Re: [CocoaProgrammingForAbsoluteBeginners] Accessing 8-bit bytes from a file using Cocoa
  • Previous by thread: Re: How to put a icon in the tray?
  • Next by thread: Re: [CocoaProgrammingForAbsoluteBeginners] Accessing 8-bit bytes from a file using Cocoa
  • Index(es):
    • Date
    • Thread