C:带函数的结构声明.存储大小未知
发布时间:2020-12-16 09:45:10 所属栏目:百科 来源:网络整理
导读:关于在struct中使用函数的问题.我从R.Stevens的书中拿走了片段,我看了几次相似的片段.我建议获得一些C和 Linux经验,但在这种情况下我真的不知道如何以正确的方式使用struct. struct stat buf; // The error line for (i=1; i argc; i++){ if (lstat(argv[i],
关于在struct中使用函数的问题.我从R.Stevens的书中拿走了片段,我看了几次相似的片段.我建议获得一些C和
Linux经验,但在这种情况下我真的不知道如何以正确的方式使用struct.
struct stat buf; // The error line for (i=1; i < argc; i++){ if (lstat(argv[i],&buf) < 0) { // Usage of err_ret("lstat error"); continue; } if (S_ISERG(buf.st_mode)) ptr = "regular"; 当我编译我的代码时,我遇到了一个错误: type.c: In function ‘main’: type.c:9:15: error: storage size of ‘buf’ isn’t known 结构声明有什么问题?我应该明确声明结构大小吗?如果是,我怎么知道呢?主要问题 – 如何使用struct方法名称? 解决方法
你忘了包括:
#include <sys/types.h> #include <sys/stat.h> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- flex 刷新父页面
- uboot的nandflash启动saveenv时Writing to Nand.
- 将xml对象(带属性)中的xml解析为cakephp中的数组
- c – 在类标题之外移动odb编译指示
- event.preventDefault() 取消事件的默认行为。
- Ruby:堆栈级别太深(SystemStackError)maxlimit
- Flex 4 SDK (Flex Hero) 并非集成进 Eclipse 就能
- Rotating labels in a Flex chart axis using th
- 【凡尘】---react-redux---【react】
- .Net与Oracle的数据库连接池(ConnectionPool)
热点阅读