社区
C语言
帖子详情
如何用宏把struct stat替换为sturct _stati64?
bbisonic
2007-12-11 10:16:17
我想将struct stat替换为struct _stati64,显然#define struct stat struct _stati64是行不通的,因为宏定义是拿空格作为分界符的,而我又不想只把stat替换为_stati64
谁能给个好的解决方案?
...全文
315
17
打赏
收藏
如何用宏把struct stat替换为sturct _stati64?
我想将struct stat替换为struct _stati64,显然#define struct stat struct _stati64是行不通的,因为宏定义是拿空格作为分界符的,而我又不想只把stat替换为_stati64 谁能给个好的解决方案?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
17 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
flyingwow99
2007-12-18
打赏
举报
回复
同意用typedef
zyb758
2007-12-18
打赏
举报
回复
我也理解错了.
zyb758
2007-12-18
打赏
举报
回复
typedef struct stat{ int hello; } stat;
typedef stat _stati64;
int main()
{
stat test1 = { 321};
_stati64 test2 = { 123};
printf("%ld\n", test1.hello);
printf("%ld\n", test2.hello);
}
不知道是不是这样的?
bbisonic
2007-12-18
打赏
举报
回复
没有人会吗?
secper
2007-12-12
打赏
举报
回复
up
chlaws
2007-12-11
打赏
举报
回复
#define (struct stat) (struct _stati64)
这样呢,不知道可不可以,呵呵,我没试过
xaobao
2007-12-11
打赏
举报
回复
同上,帮你顶起来
Treazy
2007-12-11
打赏
举报
回复
基本上你的想法比较特别,无法实现!
只能作宏替换或者类型替换!
believefym
2007-12-11
打赏
举报
回复
原来要保留struct,没看到 -_-!
believefym
2007-12-11
打赏
举报
回复
直接typedef stat _stati64;不行吗?
gcc可以通过编译
skywarship
2007-12-11
打赏
举报
回复
9楼的有道理,如果那样的话可能只能用正则表达式替换了,用脚本很容易就能搞定。
ForestDB
2007-12-11
打赏
举报
回复
用IDE的重构或者简单的替换功能。
hongyi1230
2007-12-11
打赏
举报
回复
这两个都是系统的东西,为什么在那样定!
bbisonic
2007-12-11
打赏
举报
回复
to chlaws: #define (struct stat) (struct _stati64) 这样显然是不行的
大家注意一下题目要求,只把struct stat替换为struct _stati64,而不能把所有的stat都替换为_stati64
CUG87525842
2007-12-11
打赏
举报
回复
帮顶,楼主的想法很特别!期待高手!
skywarship
2007-12-11
打赏
举报
回复
前后的struct是相同的,只换后面不同的部分就可以了
pptor
2007-12-11
打赏
举报
回复
#define stat _stati64
看看这个行不行
GORM从入门到进阶
Gorm 是当今比较热门的 Golang 的 ORM 操作数据库的工具,使用上主要是把
struct
类和数据库表进行映射,操作数据库时无需手写SQL。 本套课程将带你了解什么是GORM,如何快速使用GORM,如何使用GORM高级用法 ...
获取文件信息函数:_
stat
, _
stat
64, _
stat
i64
, _w
stat
, _w
stat
64, _w
stat
i64
Get
stat
us information on a file. int _
stat
( const char *path,
struct
_
stat
*buffer ); int _
stat
64( const char *path,
struct
__
stat
64 *buffer ); int _
stat
i64
( con
sturct
stat
结构体中 st_mode 的含义
在<sys/
stat
.h>中定义的
stat
结构体内容如下:
struct
stat
{ dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ mode_...
stat
(linux),_
stat
, _w
stat
, _
stat
i64
, _w
stat
i64
获取文件信息
Get
stat
us information on a file.int _
stat
( const char *path,
struct
_
stat
*buffer );__int64 _
stat
i64
( const char *path,
struct
_
stat
*buffer );int _w
stat
( const wchar_t *path,
struct
_
stat
通过_
stat
结构体获取文件大小
<br />获取文件大小,使用到_
stat
结构体,用_
stat
函数取得数据。
struct
_
stat
ST; _
stat
("C://xxx.iso", &ST); ST.st_size 为文件大小(Byte)。 当文件超过4GB时, char file...
C语言
69,374
社区成员
243,079
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章