| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 959 人关注过本帖
标题:有人看得懂吗?帮忙解释一下!
取消只看楼主 加入收藏
dicklin
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2004-11-1
收藏
 问题点数:0 回复次数:1 
有人看得懂吗?帮忙解释一下!
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
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.016186 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved