cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl byte order

From: ER <>
Date: Wed, 18 May 2005 09:25:03 -0400 (EDT)

Thanks for your help. The problem was with my app while handling unsigned short. I'm trying to grab a few image streams and I'm not sure if I'm using the right functions to go this.

Does anyone have examples of how to grab raw stream data from a web stream server? I'm been trying to use the easy interface "perform" but that doesn't seem to be a good choice.

On Tue, May 17, 2005 at 12:48:04PM -0400, ER wrote:
> Hi allan,
> I've used cross tool to build several libraries before and didn't have the problem.
> When I grap info from my uri I'm expecting the first two bytes to be 0xffcf but I'm getting 0xcfff.
> I have two sets of cross tools I used and both give me the same result.
> Any ideas?

libcurl just delivers you an octet stream. How that stream is interpreted
is up to your program. It sounds like it's not interpreting the data
correctly. Are you mapping a struct* or int* or similar on top of your data
buffer? That's not portable. To fix that kind of situation, you'll need to
use endian translation function, such as ntoh() and its relatives. If
that's the case, I can point you to some macros I've written to reduce
the pain of this kind of manipulation.

>>> Dan

Join Excite! -
The most personalized portal on the Web!
Received on 2005-05-18