Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

Octets

Ok. I need some code to convert octets (such as those in a response to a LIST command from a POP3 server) to bytes (something you pass to OTAllocMem()). Can anybody help me? I really need this code. The problem is that I'm not sure if octets are a base 8 numbering, if they are the number of 8-char chunks in whatever you're talking about, and whatever they are, how to convert them.
0
WileyKat
Asked:
WileyKat
  • 2
1 Solution
 
agolanCommented:
Octets are the correct name for BYTES.
Once upon a time ... well, they were computers with different byte size, some had 7 bits, some 12 bits, some had 5 bits !
The majority had 8 bits and it's the reason the term octet is no very well known.
Octet, has the same root a Octal, you are right, from the latin,
Oct is 8.
Nowadays, most only the french use "Octet" in common computer language, but thsi is definatly the right name for a bunch of 8 bits.
Now to your programming question, an Octet is equivalent to an unsigned char, values goes from 0 to 255 (total 256).

So for allocation purposes, allocate the number of octets as if they were bytes. (add one or two to be on the safe side).
Also be aware (if you are not) that the Macintosh OS usually
provide pascal strings, that unlike C string are not zero terminated. The first octet (unsigned byte) contains the lenght
of the string.
I hope it helped, otherwise please specify also language.
0
 
agolanCommented:
And it's not worth 300 points ;-)
tough it would be nice.... it's not worth it.
If you are happy, I'll be happy with half of it.
0
 
WileyKatAuthor Commented:
agolan, thanks for your help, but I never graded your answer. it's possible that too much time passed between your answer and now, since I've been away for a month. what grade did you get for it?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now