cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl byte order

From: <>
Date: Wed, 18 May 2005 13:28:26 -0000

you have to setup a write callback, and use an unsigned char array as a
buffer instead of a short int array. then you can be sure you get the
buffer filled correctly, by printf()ing the first few bytes. the easy
interface works fine.

then after that, dont cast the bytes to a short int :)


On Wed, May 18, 2005, ER <> said:

> 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.
> Thanks,
> ER
> ----------------------------------------------------------------------
> 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