社区
C语言
帖子详情
如何把CHAR*变成UNSIGNED LONG
page10
2005-03-24 08:55:55
如何用C写一个函数
其中
第一个参数是整数数组类型
第二个参数是字父符数组类型
如何把CHAR*变成UNSIGNED LONG
...全文
332
3
打赏
收藏
如何把CHAR*变成UNSIGNED LONG
如何用C写一个函数 其中 第一个参数是整数数组类型 第二个参数是字父符数组类型 如何把CHAR*变成UNSIGNED LONG
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
021850524
2005-03-24
打赏
举报
回复
char aaaa = 'a';
char *buf = &aaaa;
unsigned long l = (unsigned long)buf;
C比C++的类型检查要弱.用强制转换就行.
皮鲁
2005-03-24
打赏
举报
回复
就好像消息传递附加参数一样
lParam 是long型的,它可以存入一个指针地址
lParam<--(long)&myStructPointer
Springo0
2005-03-24
打赏
举报
回复
对,强制转化:
char a;
(unsigned long)a;
这样应该可以,我也刚学,请多指教!
ZIP 压缩 解压缩 源码
使用ZLIB库 包装的压缩解压缩文件的源码 VS2005 工程创建 /* */ class ZIPWRAP_EXP CZipper { public: CZipper(); virtual ~CZipper(); // simple interface static bool ZipFile(const
char
* szFilePath); // saves as same name with .zip static bool ZipFolder(const
char
* szFilePath, bool ignoreself = false); // saves as same name with .zip bool AddFolderToZipFile(const
char
*foldername, const
char
* rootfolder); bool AddFileToZipFile(const
char
*filename, const
char
*relfolder = NULL, const
char
* comment = NULL); bool AddFolderOnlyPathToFile(const
char
* foldername, const
char
* comment = NULL); bool OpenZipFile(const
char
* zipfilename, bool append = false); bool CloseZipFile(const
char
* global_comment = NULL); private: void* zipfile_;/* = NULL */ }; /* */ #define MAX_COMMENT (255) /* tm_unz contain date/time info */ typedef struct UZ_s {
unsigned
int tm_sec; /* seconds after the minute - [0,59] */
unsigned
int tm_min; /* minutes after the hour - [0,59] */
unsigned
int tm_hour; /* hours since midnight - [0,23] */
unsigned
int tm_mday; /* day of the month - [1,31] */
unsigned
int tm_mon; /* months since January - [0,11] */
unsigned
int tm_year; /* years - [1980..2044] */ } UZ_s; // create our own fileinfo struct to hide the underlying implementation struct UZ_FileInfo {
char
szFileName[260 + 1];
char
szComment[255 + 1];
unsigned
long
dwVersion;
unsigned
long
dwVersionNeeded;
unsigned
long
dwFlags;
unsigned
long
dwCompressionMethod;
unsigned
long
dwDosDate;
unsigned
long
dwCRC;
unsigned
long
dwCompressedSize;
unsigned
long
dwUncompressedSize;
unsigned
long
dwInternalAttrib;
unsigned
long
dwExternalAttrib; bool bFolder; UZ_s tmu_date; }; class ZIPWRAP_EXP CUnZipper { public: CUnZipper(); virtual ~CUnZipper(); // simple interface static bool UnZip( const
char
* filename, const
char
* dstfolder, bool ingorepath = false, const
char
* password = NULL); bool OpenUnZipFile(const
char
* filename); bool CloseUnZipFile(); bool UnZipTo( const
char
* dstfolder, bool ingorepath = false, const
char
* password = NULL); int GetFileCount(); bool GotoFirstFile(); bool GotoNextFile(); bool GotoZipFile(int index); bool GotoZipFile(const
char
* zipfilename); bool GetCurrentFileInfo(UZ_FileInfo&fileinfo;); bool UnCurrentZipFile(const
char
* dstfolder, bool ingorepath = false, const
char
* password = NULL); bool UnOneZipFile(const
char
* filename, const
char
* dstfolder, bool ingorepath = false, const
char
* password = NULL); bool UnOneZipFile(int index, const
char
* dstfolder, bool ingorepath = false, const
char
* password = NULL); private: void* unzipfile_; };
c语言中
char
* 和
unsigned
char
* 的区别浅析
背景最近在项目中遇到了一个编译警告,是因为定义的变量为
char
[],而在使用时作为函数的
unsigned
char
*类型的参数调用。这个警告很容易避免,但是
char
*和
unsigned
char
*到底有什么区别呢,本文作一个简单的探讨。
char
和
unsigned
char
的区别在C中,默认的基础数据类型均为signed,如定义变量为int,
long
等,都为有符号的。如果要定义无符号类型,必须显
C语言中
char
*与
unsigned
char
*的区别
C语言中
char
* 与
unsigned
char
* 的区别C语言中
char
与
unsigned
char
的区别C语言中
char
*与
unsigned
char
*的区别 指针的类型决定了指向的数据的大小和数据的解析方式 常用
char
*去指向字符串,
unsigned
char
*指向字节流。 在涉及到类型提升的上下文中,要注意使用
char
和unsinged
char
的区别。 C语言中
char
与
unsigned
char
的区别 相同点: 在内存中都是一个字节,8位(2^8=256),都能表示256个数字(-12
in_addr,
char
* ,
unsigned
long
之间的互相转换
http://blog.csdn.net/bulerain/article/details/6842636 在网络编程中经常会用到in_addr,
char
* ,
unsigned
long
表示的IP地址(指定的是IP4),winsock 提供inet_addr(
char
* ->
unsigned
long
),inet_ntoa(in_addr ->
char
*),在实际应用中,不同数据类
char
和
unsigned
char
,
char
* 和
unsigned
char
*的区别
在C语言中,默认的基础数据类型均为signed,如定义变量为int,
long
等,都为有符号的。如果要定义无符号类型,必须显式地在变量类型前加
unsigned
char
和
unsigned
char
区别 相同点:在内存中都是一个字节,8位(2^8=256),都能表示256个数字 不同点:
char
的最高位为符号位,因此
char
能表示的数据范围是-128~127,
unsigned
char
没有符号位,因此能表示的数据范围是0~255 实际使用中,如普通的赋值,读写文件和网络字节流都没有区别,不管最高位是
C语言
70,023
社区成员
243,263
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章