18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Input and output 279<br />

18.5 Self-assessment<br />

• What is the purpose of the package <strong>Ada</strong>.Sequential_io?<br />

• How can you detect if a file does not exist <strong>in</strong> <strong>Ada</strong>?<br />

• How might <strong>in</strong>put and output <strong>in</strong> <strong>Ada</strong> be simplified for the novice user?<br />

• How can you write an <strong>in</strong>stance of a record to a file?<br />

18.6 Exercises<br />

Construct the follow<strong>in</strong>g program:<br />

• Copy<br />

A program to copy a file. A user should be able to run your program by typ<strong>in</strong>g:<br />

new_copy old_file new_file<br />

• Upper case<br />

A program to convert a file <strong>in</strong> upper and lower case to all upper case. A user should be able to run your<br />

program by typ<strong>in</strong>g:<br />

to_upper_case file<br />

Note:<br />

The program should create an <strong>in</strong>termediate file then delete the orig<strong>in</strong>al file and rename the<br />

<strong>in</strong>termediate file to the orig<strong>in</strong>al file name. This operation should be safe.<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!