08-07-2017, Saat: 10:18
Bu kodu bir çin sitesinden buldum ama derlerken hata veriyor Delphi 7 kullanıyorum yardımcı olurmusunuz.
function EnterFile(const FileName:string):TInt64Array; var MyFile:TMemoryStream; rArray:TInt64Array; size,curIndex:int64; enterCount:int64; DoLoop:Boolean; pc: PChar; arrayCount:int64; addStep:integer; begin if fileName = '' then Exit; if not FileExists(fileName) then Exit; MyFile:=TMemoryStream.Create; MyFile.LoadFromFile(fileName); size:=MyFile.Size; pc:=MyFile.Memory; curIndex:=RowLeast; DoLoop:=true; enterCount:=0; setlength(rArray,perArray); arrayCount:=perArray; enterCount:=0; rArray[enterCount]:=0; while DoLoop do begin addStep:=0; if (ord(pc[curIndex])=13) then addStep:=2; if (ord(pc[curIndex])=10) then addStep:=1; if (addStep<>0) then begin Application.ProcessMessages; inc(enterCount); if (enterCount mod perArray=0) then begin arrayCount:=arrayCount+perArray; setlength(rArray,arrayCount); end; rArray[enterCount]:=curIndex+addStep; curIndex:=curIndex+addStep+RowLeast; end else curIndex:=curIndex+2; if curIndex> size then DoLoop:=false else DoLoop:=true; end; result:=rArray; freeandnil(MyFile); end;