Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- TByteArray = array of byte;
- function FileReadAllBytes(fileName: string): TByteArray;
- const
- readBufSize = 1023;
- var
- res: TByteArray;
- myFile: File of byte;
- readBuf: array [0..readBufSize] of byte;
- i, j: integer;
- readInFact: integer;
- begin
- AssignFile(myFile, fileName);
- Reset(myFile);
- SetLength(res, FileSize(myFile));
- i := 0;
- repeat
- blockread(myFile, readBuf, readBufSize+1, readInFact);
- for j := 0 to readInFact - 1 do
- begin
- res[i] := readBuf[j];
- i := i + 1;
- end;
- until i >= FileSize(myFile);
- Result := res;
- end;
- var
- test3: TByteArray;
- ....
- test3 := FileReadAllBytes('bigfile.txt');
- IdTCPClient1.WriteBuffer(Pointer(test3)^, Length(test3));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement