[译]制作文件-文件创建实用程序
By robot-v1.0
本文链接 https://www.kyfws.com/applications/make-a-file-file-creation-utility-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 3 分钟阅读 - 1272 个词 阅读量 0[译]制作文件-文件创建实用程序
原文地址:https://www.codeproject.com/Articles/3629/Make-A-File-File-Creation-Utility
原文作者:Andreas Saurwein
译文由本站 robot-v1.0 翻译
前言
Utility to easily create files for testing purposes. Also supports creating really huge files.
用于轻松创建文件以进行测试的实用程序.还支持创建非常大的文件.
介绍(Introduction)
在开发过程中,我们常常需要测试文件,以查看应用程序对大小不同的文件的行为,或者只是作为各种测试的"有效负载".(Often we need test files during development, either to see how an application behaves with differently sized files or just as a “payload” for various tests.)
Make-A-File实用程序仅用于此目的-创建文件.它们可以介于1字节和18 Eb(艾字节,即18.432.000.000.000.000.000字节)之间,并填充垃圾,随机值或零.(The Make-A-File utility is written just for this purpose - to create files. They can be between 1 byte and 18 Eb (Exabytes, thats about 18.432.000.000.000.000.000 bytes) filled with garbage, random values or zeroes.)
用法(Usage)
选择一个文件名(键入或单击" …“按钮)和一个大小.大小由大小字段中的数字和下拉列表中的单位组成.下拉列表提供了Bytes,Kb,Mb,Gb,Tb,Pb和Eb(每个都比前一个大1000倍).最终的文件大小(以字节为单位)显示在底部的字段中.(Choose a filename (type or click on the “…” button) and a size. The size is made up by the number in the size field and a unit from the dropdown list. The dropdown list offers Bytes, Kb, Mb, Gb, Tb, Pb and Eb (each being a 1000 times bigger than the previous). The resulting file size in bytes is shown in the field at the bottom.)
复选框"随机内容"使用随机字节填充文件(谁会猜到这一点). “快速创建"复选框用于快速创建文件并填充垃圾.从技术上讲,它使用(The checkbox “Random content” fills the file with, who would have guessed this, random bytes. The “Quick Create” checkbox is used to create a file quick and filled with garbage. Technically it uses) SetFilePointer()
来设置文件的结尾,这将导致什么都不会写入文件,而是为其内容分配磁盘空间.(to set the end of the file, which results in nothing being written to the file but allocates the disk space for its contents.)
请参阅MSDN了解其含义.(Please see the MSDN for the implications.)
默认情况下,快速创建还会检查随机内容.(By default, the quick create also checks the random content.)
如果您使用启用了文件压缩的NTFS,并且没有启用随机内容或快速创建选项,则可以在任何硬盘上轻松创建10 Tb(甚至更大)的文件.(If you are using NTFS with file compression enabled, you can easily create a 10 Tb (or even bigger) file on any hard disk if you do not enable the random content or quick create options.)
如何运作?(How this works?)
很简单,如果未启用这些选项,则程序将向磁盘写入零流,然后将其压缩为文件系统上几乎没有内容.任何只包含所有相同字节的文件将只为目录条目分配一个单位.(Simple, if none of these options is enabled then the program will write a stream of zeroes to the disk which get compressed to literally nothing on the file system. Any file which contains only all the same bytes allocates only one unit for the directory entry.)
信息(Information)
它是在VC6下用MFC编写的,并且在W2k和XP Pro下经过了测试(但应在任何Win32平台上运行).归档文件包含发行可执行文件和源代码.(It is written with MFC under VC6 und is tested under W2k and XP Pro (but should run on any Win32 plattform). The archive contains a release executable and the source code.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 WinXP Windows Win2K MFC Visual-Studio Dev 新闻 翻译