| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 583 人关注过本帖
标题:C语言对软盘进行读写
只看楼主 加入收藏
zjw807882628
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-10-22
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:4 
C语言对软盘进行读写
谁能告诉我用C语言对软盘进行读写啊,最好能有一段代码(带注释的)给我参考一下
搜索更多相关主题的帖子: C语言 最好 
2013-04-10 20:16
fanpengpeng
Rank: 8Rank: 8
来 自:南极洲
等 级:蝙蝠侠
威 望:7
帖 子:299
专家分:849
注 册:2013-2-1
收藏
得分:5 
这年头 还有在研究软盘的

人生是一场错过 愿你别蹉跎
2013-04-10 20:35
pauljames
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:千里冰封
威 望:9
帖 子:1555
专家分:10000
注 册:2011-5-8
收藏
得分:5 
操作系统的接口函数,应该提供一致的文件操作类函数,不一致的用ioctl来区分

经常不在线不能及时回复短消息,如有c/单片机/运动控制/数据采集等方面的项目难题可加qq1921826084。
2013-04-10 21:23
邓士林
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:淮河河畔
等 级:贵宾
威 望:61
帖 子:2392
专家分:13384
注 册:2013-3-3
收藏
得分:5 
函数名: absread, abswirte
   能: 绝对磁盘扇区读、写数据
   法: int absread(int drive, int nsects, int sectno, void *buffer);
  int abswrite(int drive, int nsects, in tsectno, void *buffer);
 程序例:
 /* absread example */
 
#include <stdio.h>
 #include <conio.h>
 #include <process.h>
 #include <dos.h>
 
int main(void)
 {
   int i, strt, ch_out, sector;
   char buf[512];
 
  printf("Insert a diskette into drive A and press any key\n");
   getch();
   sector = 0;
   if (absread(0, 1, sector, &buf) != 0)
   {
      perror("Disk problem");
      exit(1);
   }
   printf("Read OK\n");
   strt = 3;
   for (i=0; i<80; i++)
   {
      ch_out = buf[strt+i];
      putchar(ch_out);
   }
   printf("\n");
   return(0);
 }
 


函数名: absread, abswirte
   能: 绝对磁盘扇区读、写数据
   法: int absread(int drive, int nsects, int sectno, void *buffer);
  int abswrite(int drive, int nsects, in tsectno, void *buffer);
 程序例:
 /* absread example */
 
#include <stdio.h>
 #include <conio.h>
 #include <process.h>
 #include <dos.h>
 
int main(void)
 {
   int i, strt, ch_out, sector;
   char buf[512];
 
  printf("Insert a diskette into drive A and press any key\n");
   getch();
   sector = 0;
   if (absread(0, 1, sector, &buf) != 0)
   {
      perror("Disk problem");
      exit(1);
   }
   printf("Read OK\n");
   strt = 3;
   for (i=0; i<80; i++)
   {
      ch_out = buf[strt+i];
      putchar(ch_out);
   }
   printf("\n");
   return(0);
 }
 

Maybe
2013-04-10 22:10
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:5 
看到include进来一个dos.h,就该知道是怎么回事。

授人以渔,不授人以鱼。
2013-04-10 22:20
快速回复:C语言对软盘进行读写
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019807 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved