|
|
1
28
使用Win32 API, CreateFile SetFilePointerEx , SetEndOfFile 和 CloseHandle 诀窍在于SetFilePointerEx函数。从MSDN:
|
|
|
2
3
|
|
|
3
2
|
|
|
4
1
使用“fsutil”命令: E:\VirtualMachine>fsutil文件createnew 例如:fsutil文件createnew C:\testfile.txt 1000 雷格斯 另外,它适用于Windows:2000/XP/7 |
|
5
0
sparse files 我们的道路是:
|
|
|
6
0
我知道你的问题被贴上了Windows标签,Brian R.Bondy为你的问题提供了最好的答案,如果你确定你不必将应用程序移植到其他平台。但是,如果您可能需要将应用程序移植到其他平台,您可能需要做一些更像Adrian Cornish提出的问题,即“如何创建x大小的文件?”的答案 How to create file of "x" size?
当然,还有一个额外的转折点。Adrian Cornish提出的答案使用了具有以下特征的fseek函数。
问题是您想要创建一个文件大小超出32位整数范围的非常大的文件。您需要使用64位等效的fseek。不幸的是,在不同的平台上,它有不同的名称。 在中找到头文件LargeFileSupport.h http://mosaik-aligner.googlecode.com/svn-history/r2/trunk/src/CommonSource/Utilities/LargeFileSupport.h 为这个问题提供了一个解决方案。 这将允许您编写以下函数。
我想我会加上这个,以防这些信息对你有用。 |
|
|
PHPLover · “支持PHP扩展或功能的端口”实际上是什么意思? 2 年前 |