早教吧 育儿知识 作业答案 考试题库 百科 知识分享

#include"include/apue.h"intmain(viod){intfd;if(fd=open(/home/cheng/apue.2e/test.c,ORDONLY))printf("can'topen\n");elseprintf("ok\n");exit(0);想看下open函数的用法,但是gcc编译时报错test.c:Infunction‘main’:test.c:5:error:expect

题目详情
#include "include/apue.h"
int main(viod)
{
int fd ;
if(fd=open(/home/cheng/apue.2e/test.c,O_RDONLY))
printf("can't open\n");
else
printf("ok\n");
exit(0);
想看下open函数的用法,但是gcc编译时报错
test.c:In function ‘main’:
test.c:5:error:expected expression before ‘/’ token
test.c:5:34:error:exponent has no digits
open函数,我用的不是c库,是linux下api
▼优质解答
答案和解析
"/home/cheng/apue.2e/test.c"
你用 man open自己看下第一个参数的原型是什么.