Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
WRITER.PAS
◄Example► ◄Contents► ◄Index► ◄Back►
PROGRAM writer;
{ WRITER.PAS shows the results of the Writeln procedure for output of
various types of data to a text file. It uses the procedures:
Pi Writeln
Note that the Write procedure has exactly the same result, except that
it does not output a carriage-return character to terminate the line.
}
CONST
program_name = 'WRITER ';
program_desc = ' illustrates output with the Writeln procedure.';
num = 6656;
ostring = 'abcdefghijklmnopqrstuvwxyz';
fmt1 = '123456789012345678901234567890';
fmt2 = '---------1---------2---------3';
BEGIN
Writeln( program_name, program_desc );
Writeln;
Writeln( 'Format string Output' );
Writeln;
Writeln( 'REAL data: ', fmt2 );
Writeln( ' ', fmt1 );
Writeln( 'PI ', Pi ); { default, assumes 17}
Writeln( 'PI:5 ', Pi:5 ); { widths < 8 default to 8 }
Writeln( 'PI:10 ', Pi:10 );
Writeln( 'PI:17:11 ', Pi:17:11 ); { maximum size }
Writeln( 'PI:13:5 ', Pi:13:5 );
Writeln( 'PI:3:0 ', Pi:3:0 );
Writeln;
Writeln( '-PI ', -Pi ); { default, assumes 17}
Writeln( '-PI:5 ', -Pi:5 ); { widths < 8 default to 8 }
Writeln( '-PI:10 ', -Pi:10 );
Writeln( '-PI:17:11 ', -Pi:17:11 ); { maximum size }
Writeln( '-PI:13:5 ', -Pi:13:5 );
Writeln( '-PI:3:0 ', -Pi:3:0 );
Writeln;
Writeln( 'INTEGER data: ', fmt2 );
Writeln( ' ', fmt1 );
Writeln( 'number ', num ); { default }
Writeln( 'number:6 ', num:6 ); { leading spaces }
Writeln( 'number:-6 ', num:-6); { left justified }
Writeln( 'number:2 ', num:2 ); { enlarges field to fit }
Writeln;
Writeln( 'STRING data: ', fmt2 );
Writeln( ' ', fmt1 );
Writeln( 'string: ', ostring );
Writeln( 'string:20 ', ostring:20 ); { whole string }
Writeln( 'string:30 ', ostring:30 ); { leading spaces }
Writeln( 'string:-30 ', ostring:-30 ); { left justified }
Writeln;
Writeln( 'BOOLEAN data:' );
Writeln( 'True: ', True );
Writeln( 'False:1 ', False:1 );
Writeln( 'True:6 ', True:6 );
Writeln( 'True:-6 ', True:-6 );
Writeln;
END.