Contents

 What are write parameters?

Description

Write parameters are used, with the write and writeln procedures, to specify the values that these procedures should write to files.

Writing To Non-Text Files

If the file being written to is not a text file (i.e. not a file associated with a file variable of type text) then the write parameters are just expressions, and the values of these expressions are written without conversion to the file.

Writing To Text Files

If the file being written to is a text file (i.e. a file associated with a file variable of type text) then the write parameters can be made up of the following three items:

  1. An expression specifying the value to be written to the file. NOTE: Non-string values are converted to string values before being written to the file, however the type of the write parameter is the type of the value before it was converted.
  2. An optional expression of integral type that specifies the minimum width of the string value written to the file. If this item is not supplied then the minimum width used depends on the type of the write parameter as follows: If the write parameter has an integral type or boolean type then the default minimum width is eigth (8). If the write parameter is of real type then the default minimum width is nine (9). If the write parameter is of string type then the default minimum width is the length of the string. If the write parameter is of If the write parameter is of any other type then the default minimum width is one (1).
  3. An optional expression of integral type that specifies the number of digits that follow the decimal point in the converted string (the value is converted into a fixed point representation). If this item is not supplied, and a value of real type is being converted, then the value is converted into an exponential representation. NOTE: This item only be used when the write parameter is of real type.
If the string value being written to the text file is shorter than the minimum width then it is padded with spaces on the left until it is the same length as the minimum width. If the string value being written to the file is longer than the minimum width then the entire string value is written to the file unless the write parameter is of string type or of boolean type in which case the string value is truncated on the right to the same length as the minimum width.

Contents