copy ur input data to a buffer
登录 | 论坛导航 -> 华新鲜事 -> 社会百科 | 本帖共有 1 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:小诸葛 (等级:2 - 初出茅庐,发帖:41) 发表:2003-08-22 14:03:11  楼主  关注此帖
unsigned short* vs unsigned long* -- help!Ge Wei Da Xia, I'm writing a c program which utilizes someone else's function. This function takes in a bit vector by "unsigned short * " pointer. However, the corresponding bit vector I pass to this function is constructed with "unsigned long * " pointer. Therefore, in Linux and Windows, because of the endian convention, the bit vector passed over is not what I want. For example, under unsigned long pointer, I have 0x12345678. But when casted into unsigned short, it becomes 0x5678 0x1234. Now, the only thing I can think of is to either change my own program (which needs quite a lot of changes) or change that person's program (which needs just as much changes, and the code is hard to understand). So I'm wondering, does any of the wizards here have better ways of dealing with this? Thanks very very much!
copy ur input data to a buffer
then cast it into short format.
thus without changing your portion and
the 3rd function, u will handle this problem.

Put your OWN COOL signature here!
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 社会百科 | 返回上一页 | 本主题共有 1 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码