# Re: 如何设定档案结尾

Posted by 老怪 on September 13, 1998 at 21:15:26:

In Reply to: 如何设定档案结尾 posted by GG on September 10, 1998 at 22:37:49:

: 假设我有一个6k大的随机档
: 但是我想让档案缩小一点
: (后段的资料就不要了)
: 那该如何在4k的部分 设档案结尾
: 让档按大小 只有4k

用二进位取档
Dim Buff() As Byte
Dim FileHandle As Integer
FileHandle = FreeFile
Open "YourFilePathAndName" For Binary As #FileHandle
ReDim Buff(LOF(FileHandle) - 1)
Get #FileHandle, , Buff
Close #FileHandle

Redim Buff(4096)

FileHandle = FreeFile
Open "YourFilePathAndName" For Binary As #FileHandle
Put #FileHandle, , Buff
Close #FileHandle

Follow Ups: