新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > vxworks下文件读写示例

vxworks下文件读写示例

作者: 时间:2016-10-08 来源:网络 收藏

1.create file on floopy disk and write contents:

本文引用地址:https://www.eepw.com.cn/article/201610/305792.htm

-> pdev=fdDevCreate(0,0,0,0) /* A:,1.44M,whole disk,offset */

-> dosFsMkfs(/fd0,pdev)

-> fd=creat(/fd0/myfile,2) or -> fp=fopen(/fd0/myfile,w)

-> buf=what you want to write to file

-> write(fd,buf,strlen(buf)+1) or -> fprintf(fp,buf)

-> close(fd) or -> fclose(fp)

2.open file and read contents from floopy disk:

-> readbuf=malloc(100)

-> fd=open(/fd0/myfile,2) or -> fp=fopen(/fd0/myfile,r)

-> read(fd,readbuf,100) or -> fread(readbuf,1,50,fp)

-> printf readbuf

-> close(fd) or -> close(fp)

3.on simpc shell:

-> fp=fopen(host:d:/temp/myfile,w)

-> fprintf(fp,kjkkhjk)

-> fclose(fp)



关键词:

评论


相关推荐

技术专区

关闭