Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Pascal/HP-UX Programmer's Guide > Chapter 5 Allocation and Alignment

Files

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

When your program declares a file, the compiler allocates space for the file control block and the file buffer variable. The amount of space allocated to each is fixed by the packing algorithm. The file is 8-byte-aligned.

Table 5-11 “Allocation of File Components (HP Pascal Packing Algorithm) ” shows how the HP Pascal packing algorithm allocates file components for textfiles and nontextfiles.

Table 5-11 Allocation of File Components (HP Pascal Packing Algorithm)

File Component

Textfile

Nontextfile

Control block

324 bytes

320 bytes

Buffer variable

254 bytes

Size of component type

 

Sometimes you can reduce file buffer size or increase file operation speed by the way you declare a file. Compare the following file definitions, their buffer sizes, and how you can write 100 integers to them.

Table 5-12 Title not available (Files )

Declaration

Buffer Size

How to Write 100 Integers to the File

VAR
f : FILE OF integer;

4 bytes

FOR i:=1 TO 100 DO write(f,i);

(100 calls to put)
VAR
f : FILE OF
ARRAY [1..100]
OF integer;

400 bytes

FOR i:=1 TO 100 DO f^[i]:=i;
put(f);

(One call to put)

 

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.