function SplitFile(const FileName: string; Size: Cardinal): Boolean; var fStream: TFileStream; {原始文件} toStream: TMemoryStream; {分文件} p,i: Integer; {p 记录当前指针位置; i 记录这是第几个分的文件} begin Result := False;
Size := Size * 1024; {把大小的单位转换为字节}
fStream := TFileStream.Create(FileName, fmOpenRead); p := 0; i := 0;
toStream := TMemoryStream.Create;
while p < fStream.Size do begin toStream.Clear; {清空上次数据} fStream.Position := p; {放好指针位置}
if fStream.Size-p < Size then Size := fStream.Size-p; {最后一个时, 有多少算多少}
toStream.CopyFrom(fStream, Size); {复制}
toStream.SaveToFile(FileName + '.' + IntToStr(i)); {保存}
Inc(i);
p := p + Size;
end;
fStream.Free; toStream.Free; Result := True; end;
var infile:string = 'Asahi.wav'; begin // infile SplitFile(infile,1010241024); // 分割成10MB的大小 end.