Tag: solaris

如何使用S_ISREG()和S_ISDIR()POSIX宏?

这是我写的一个C程序,用于递归导航和输出目录和常规文件。 它在我的Linux机器上编译并运行良好。 但是在Solaris上, dit->d_type == 8检查和其他类似的检查不起作用,因为没有d_type字段。 我已经读过这个问题的答案是使用S_ISREG()和S_ISDIR()宏,但是它们在我目前的代码中完全无法工作。 我评论了在我的Linux机器上运行的行。 #include #include #include #include #include #include #include #include void helper(DIR *, struct dirent *, struct stat, char *, int, char **); void dircheck(DIR *, struct dirent *, struct stat, char *, int, char **); int main(int argc, char *argv[]){ DIR *dip; struct dirent *dit; struct stat statbuf; […]

如何使YY_INPUT指向Lex&Yacc(Solaris)中的字符串而不是stdin

我希望我的yylex()解析字符串而不是文件或标准输入。 如何使用Solaris提供的Lex和Yacc?