4940|6

62

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

请问vxworks中如何创建一个文件,有没有例子啊 [复制链接]

 请问vxworks中如何创建一个文件,有没有例子啊

最新回复

好像没那么简单,呵呵.  详情 回复 发表于 2008-5-1 13:40
点赞 关注
 

回复
举报

64

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
creat函数,帮助里有的。
 
 
 

回复

89

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
mark~
 
 
 

回复

76

帖子

0

TA的资源

一粒金砂(初级)

4
 
用普通的文件open()函数就可以了.
#include

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

 
 
 

回复

84

帖子

0

TA的资源

一粒金砂(初级)

5
 
对头,用普通的creat(),open()函数就可以了,其中creat和open效果一样,他们最终调用同一个函数,最终文件保存在你设置里放vxworks的位置,比如我的就放在D:\目录下了,试试看吧
 
 
 

回复

79

帖子

0

TA的资源

一粒金砂(初级)

6
 
用了文件系统了?TFFS的?
 
 
 

回复

81

帖子

0

TA的资源

一粒金砂(初级)

7
 
好像没那么简单,呵呵.
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表