Previous topic | Next topic | Ada Home Page | Index

Reading text files

When reading data from text files, you often need to take particular actions at the end of each line or page. You certainly need to recognise when the end of data has been reached and it is time to stop reading.

Thus you need to look out for the special characters that represent end_of_line, end_of_page, and end_of_file.

TEXT_IO includes functions to check file position.

File position functions

END_OF_FILE

END_OF_LINE

END_OF_PAGE

Examples:

	if END_OF_PAGE (infile) then ...

	while not END_OF_FILE loop ...


Common file processing

Standard pieces of code can be written using these file position functions, to recognise the text file structure and process the data appropriately.

The appropriate code depends on how you view the data:

Here we show you how to write code to read and process:


Previous topic | Next topic | Ada Home Page | Index
c-lokan@adfa.oz.au / 23 Feb 96