设为首页
收藏本站
用户名
Email
自动登录
找回密码
密码
登录
注册
快捷导航
平台
Portal
论坛
BBS
文库
项目
群组
Group
我的博客
Space
搜索
搜索
热搜:
shell
linux
mysql
本版
用户
LinuxSir.cn,穿越时空的Linuxsir!
»
论坛
›
编程开发讨论区 —— LinuxSir.cn
›
Linux 程序设计专题讨论
›
类型强制转换有点问题
返回列表
查看:
695
|
回复:
3
类型强制转换有点问题
[复制链接]
sybaselu
sybaselu
当前离线
积分
642
IP卡
狗仔卡
发表于 2006-6-22 09:56:34
|
显示全部楼层
|
阅读模式
typedef unsinged long u32
const char* time = "1000000";
u32 stationtime;
stationtime = const_cast<u32* >time;
复制代码
转不过来,有其他方法吗?
回复
使用道具
举报
提升卡
置顶卡
沉默卡
喧嚣卡
变色卡
显身卡
pointer
pointer
当前离线
积分
496
IP卡
狗仔卡
发表于 2006-6-22 12:32:41
|
显示全部楼层
man strtol
man atol
回复
支持
反对
使用道具
举报
显身卡
formalin14
formalin14
当前离线
积分
236
IP卡
狗仔卡
发表于 2006-6-22 13:50:40
|
显示全部楼层
man strtoul
回复
支持
反对
使用道具
举报
显身卡
rickxbx
rickxbx
当前离线
积分
1256
IP卡
狗仔卡
发表于 2006-6-22 14:12:27
|
显示全部楼层
这么多天了,怎么还问这么初级的cpp问题?
有两个办法:
1. 用传统 c 的方法: stationtime = (u32)time;
2. 用 cpp 方式: stationtime = reinterpret_cast<u32>(time);
btw: 还是那句话,有没有看过一本 cpp 的书?
回复
支持
反对
使用道具
举报
显身卡
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
注册
本版积分规则
发表回复
回帖后跳转到最后一页
Copyright © 2002-2023
LinuxSir.cn
(http://www.linuxsir.cn/) 版权所有 All Rights Reserved.
Powered by
RedflagLinux!
技术支持:
中科红旗
|
京ICP备19024520号
快速回复
返回顶部
返回列表