社区
C语言
帖子详情
如何用宏把struct stat替换为sturct _stati64?
bbisonic
2007-12-11 10:16:17
我想将struct stat替换为struct _stati64,显然#define struct stat struct _stati64是行不通的,因为宏定义是拿空格作为分界符的,而我又不想只把stat替换为_stati64
谁能给个好的解决方案?
...全文
327
17
打赏
收藏
如何用宏把struct stat替换为sturct _stati64?
我想将struct stat替换为struct _stati64,显然#define struct stat struct _stati64是行不通的,因为宏定义是拿空格作为分界符的,而我又不想只把stat替换为_stati64 谁能给个好的解决方案?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用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
看看这个行不行
struct
stat
结构体
S_IWOTH 00002 其他用户具可写入权限 S_IXOTH 00001 其他用户具可执行权限 具体使用 依赖的头文件 #include #include #include 使用的函数 int
stat
(const char *path,
struct
stat
*buf); 第一个参数是文件的...
struct
stat
详解
stat
,l
stat
,f
stat
1 函数都是获取文件(普通...函数原型#include int
stat
(const char *restrict pathname,
struct
stat
*restrict buf);提供文件名字,获取文件对应属性。int f
stat
(int filedes,
struct
stat
*buf
linux
struct
stat
结构
linux
struct
stat
结构 2010-10-25 17:03:20 分类:
struct
stat
{ dev_t st_dev; /* ID of device containing file -文件所在设备的ID*/ ino_t st_ino; /* inode number -inod
struct
stat
介绍和使用
struct
stat
是在 C 和 C++ 语言中使用的一种结构体,通常用于存储文件的各种属性信息。它是 POSIX 标准的一部分,广泛应用于 Unix 和 Unix-like 操作系统(如 Linux 和 macOS)。
sturct
stat
结构体中 st_mode 的含义及其使用方法
* ID of device containing file -文件所在设备的ID*//* device ID (if special file) -设备号,针对...total size, in bytes -文件大小,字节为单位*/mode_t st_mode;/* 文件的类型和存取的权限*/st.mode的寄存器。
C语言
70,024
社区成员
243,263
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章