我开始不知道一个文件的大小,但是我要为该文件的大小开辟一个空间,应该怎样做?

解决方案 »

  1.   

    一个建立文件的程序,这个程序可以快速建立一个空的大文件(可以有几十M)。http://www.applevb.com/sourcecode/create%20sfile.zip
      

  2.   

    http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=190250
      

  3.   

    如果不想用 api 的话,也可以用vb的函数。SetFileSize( "bigfile.txt", 1024&*1024& ) '给bigfile.txt文件预分配1兆的空间
    sub SetFileSize(byval filen as string, byval filelen as long)
      dim ff as integer
      ff=freefile
      open filen for binary as ff
      seek ff,filelen
      put ff,,vbnullchar
      close ff
    end sub