如何用宏把struct stat替换为sturct _stati64?

bbisonic 2007-12-11 10:16:17
我想将struct stat替换为struct _stati64,显然#define struct stat struct _stati64是行不通的,因为宏定义是拿空格作为分界符的,而我又不想只把stat替换为_stati64
谁能给个好的解决方案?
...全文
315 17 打赏 收藏 转发到动态 举报
写回复
用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
看看这个行不行

69,374

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧