当前位置:首页 > 嵌入式 > 嵌入式软件
[导读] 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/myfil

 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)

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除( 邮箱:macysun@21ic.com )。
换一批
延伸阅读
关闭