zoukankan      html  css  js  c++  java
  • vxworks下文件读写示例 分类: vxWorks 2014-01-23 11:52 762人阅读 评论(0) 收藏

    dev

    1.create file on floopy disk and write contents:
    -> 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)

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    UIAlertView
    网络请求ASIhttp
    省份城市选择
    Certificates
    UTF8
    xcode增加注释插件
    常用片段 button Label
    开发铺助工具
    iOS UI框架
    iOS 引导页
  • 原文地址:https://www.cnblogs.com/mao0504/p/4706668.html
Copyright © 2011-2022 走看看