| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 959 人关注过本帖
标题:有人看得懂吗?帮忙解释一下!
只看楼主 加入收藏
dicklin
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2004-11-1
收藏
 问题点数:0 回复次数:5 
有人看得懂吗?帮忙解释一下!
Write a program to simulate the operation of a hard drive.

The hard drive is to be simulated by creating a file called 'HardDrive'. This contains 256 'sectors', each 128 bytes long. This means that the file is 32 kilobytes in size.

To create the HardDrive file, you should write a separate function. Declare an array of 128 characters, fill it up with spaces, open the 'HardDrive' file in write mode, and write the array 256 times to the file. Then close the file.

Next create two data files of your own choice (I suggest you create a short one and a longer one). Open the HardDrive file in O_RDWR mode. Write the files onto the HardDrive, one sector at a time. This requires use of the 'lseek' and 'write' system calls. Make sure to choose their positions within the HardDrive in such a way that they don't overlap, and don't run off the end! Once this has been done (for both files), read them back from the HardDrive, and display their contents on the screen. The result should, of course, be the same as the original files. Please note that the last sector of each file requires special treatment (because it is filled partially).

Note that this whole procedure resembles the way in which a real Operating System uses a real hard drive.

搜索更多相关主题的帖子: 解释 
2004-11-23 00:39
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 
没懂!
2004-11-23 20:41
nolove
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2004-11-24
收藏
得分:0 

这是一个关于对磁盘操作的吧。。。


[glow=400,#0033FF,2]多情自古傷離別 更那堪冷落清鞦節 今宵酒醒何處 楊柳岸曉風殘月 此去經年 應是良辰好景虛設 便縱有韆種風情 更與何人說[/glow] " target="_blank">http://www.
2004-11-24 17:06
corrupt
Rank: 2
等 级:新手上路
威 望:3
帖 子:535
专家分:0
注 册:2004-9-29
收藏
得分:0 

不懂~


2004-11-24 23:00
poppylx
Rank: 1
等 级:新手上路
帖 子:367
专家分:0
注 册:2004-9-27
收藏
得分:0 
以下是引用dicklin在2004-11-23 00:39:54的发言:
写一个模拟hard drive的程序(谁都知道吧) Write a program to simulate the operation of a hard drive.
这个hard dirve通过一个叫"HardDrive"的文件来模拟,这个harddrive包括256个扇区(sectors),没个扇区128字节,即这个文件有32kb长 The hard drive is to be simulated by creating a file called 'HardDrive'. This contains 256 'sectors', each 128 bytes long. This means that the file is 32 kilobytes in size.
对于建立这个文件,你需要写一个分割函数(可能理解有错误),声明一个128字符长的数组(好象理解上也有问题,可能为一组128字符,费解),并使用空间填充.用写模式打开这个文件并写这个数组256次然后关闭他. To create the HardDrive file, you should write a separate function. Declare an array of 128 characters, fill it up with spaces, open the 'HardDrive' file in write mode, and write the array 256 times to the file. Then close the file. Next create two data files of your own choice (I suggest you create a short one and a longer one). Open the HardDrive file in O_RDWR mode. Write the files onto the HardDrive, one sector at a time. This requires use of the 'lseek' and 'write' system calls. Make sure to choose their positions within the HardDrive in such a way that they don't overlap, and don't run off the end! Once this has been done (for both files), read them back from the HardDrive, and display their contents on the screen. The result should, of course, be the same as the original files. Please note that the last sector of each file requires special treatment (because it is filled partially). Note that this whole procedure resembles the way in which a real Operating System uses a real hard drive.

呼~~~~~ 不行了 好多看不懂的


动于心而静如水
2004-11-25 01:44
dicklin
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2004-11-1
收藏
得分:0 

写一个可模仿硬件操作的程序 生成一个叫做“硬驱”的文件模仿硬盘驱动器。这个文件包括:256个部分,每个部分128比特长,意味着这个文件的长度为32kb。 你必须通过建立一个独立的函数来生成这个硬驱文件。声明一个128字符的数组,用空格把它填满,以写模式打开这个文件,把上数组写入文件256次,然后关闭文件。

这是第一步的翻译,麻烦大家拉~~

2004-12-09 04:43
快速回复:有人看得懂吗?帮忙解释一下!
数据加载中...
 
   



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

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