#include <ioLib.h>
open( )
NAME
open( ) - open a file
SYNOPSIS
int open
(
const char * name, /* name of the file to open */
int flags, /* O_RDONLY, O_WRONLY, O_RDWR, or O_CREAT */
int mode /* mode of file to create (UNIX chmod style) */
)
DESCRIPTION
This routine opens a file for reading, writing, or updating, and returns a file descriptor for that file. The arguments to open( ) are the filename and the type of access:
O_RDONLY (0) (or READ) - open for reading only.
O_WRONLY (1) (or WRITE) - open for writing only.
O_RDWR (2) (or UPDATE) - open for reading and writing.
O_CREAT (0x0200) - create a file.
In general, open( ) can only open pre-existing devices and files. However, for NFS network devices only, files can also be created with open( ) by performing a logical OR operation with O_CREAT and the flags argument. In this case, the file is created with a UNIX chmod-style file mode, as indicated with mode. For example:
fd = open ("/usr/myFile", O_CREAT | O_RDWR, 0644)
Only the NFS driver uses the mode argument.
NOTE
For more information about situations when there are no file descriptors available, see the manual entry for iosInit( ).
RETURNS
A file descriptor number, or ERROR if a file name is not specified, the device does not exist, no file descriptors are available, or the driver returns ERROR.
ERRNO
ELOOP
SEE ALSO
ioLib, creat( )
VARARGS2
其中creat和open效果一样,他们最终调用同一个函数,最终文件保存在你设置里放vxworks的位置,比如我的就放在D:\目录下了,试试看吧
visual studio2019中添加外部文件或者文件夹:
1.现在在visual studio中新建一个项目:
7.配置附加包含目录:点击项目,再点击属性。然后再“c/c++”下“常规”设置“附加包含目录”,即填写需要包含文件的文件夹路劲,如果有多个文件夹路劲则用分号空开。最后点击确认即可
程序输出结果为100,项目导入外部文件成功!类似的将外部文件夹导入项目中类似 *** 作
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)