[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Set size of text file internal buffer
Source position: line 0
procedure SetTextBuf( |
var f: Text; |
var Buf |
); |
var f: Text; |
var Buf; |
Size: SizeInt |
); |
SetTextBuf assigns an I/O buffer to a text file. The new buffer is located at Buf and is Size bytes long. If Size is omitted, then SizeOf(Buf) is assumed. The standard buffer of any text file is 128 bytes long. For heavy I/O operations this may prove too slow. The SetTextBuf procedure allows to set a bigger buffer for the I/O of the application, thus reducing the number of system calls, and thus reducing the load on the system resources. The maximum size of the newly assigned buffer is 65355 bytes.
Remark: |
|
No checking on Size is done.
|
Assign a name to a file |
|
|
Open file for reading |
|
|
Open file for writing |
|
|
Open a file in append mode |
Program Example61; { Program to demonstrate the SetTextBuf function. } Var Fin,Fout : Text; Ch : Char; Bufin,Bufout : Array[1..10000] of byte; begin Assign (Fin,paramstr(1)); Reset (Fin); Assign (Fout,paramstr(2)); Rewrite (Fout); { This is harmless before IO has begun } { Try this program again on a big file, after commenting out the following 2 lines and recompiling it. } SetTextBuf (Fin,Bufin); SetTextBuf (Fout,Bufout); While not eof(Fin) do begin Read (Fin,ch); write (Fout,ch); end; Close (Fin); Close (Fout); end.
lazarus-ccr.sourceforge.net |