Notes for 9/12/06 – courtesy of Antony Tomasello

 

 

Filenames should always be variables. They should never be hardcoded because your paths and filenames may differ from my test ones..

 

Standard Heading

         Assignment

         Programmer

         Course

         Date

         Compiler

         Professor

         Filename

         Executable

 

Prompts are outputs and being outputs, they must be listed as outputs

 

Print a line at the end of a program stating that the program ended normally.

 

Always echo input data

 

When possible, use constants instead of literals.

 

Always submit source code and executable.

 

When prompting for an input filename, initalize the filename to all blanks. (NOTE: please see the blackboard discussion board for help on how to avoid a potential error reading in your user’s filename)

 

String is a predifined type, but it is not a reserved word.

Declaration of a string

stringName : String(1..nameSize);

 

Every element of the array that is not specified can be initalized using OTHERS =>

 

types for file: ada.text_io.file_type

 

inputFile : ada.text_io.file_type;

 

opening files

ada.text_io.open(

   file => inputFile,

   mode => ada.text_io.in_file,

   name => inputFileName);

 

Input files have to exist or an error will occur.

 

to read input from a file

ada.integer_text_io.get(

file => inputFile,

item => variableName);

 

to write output to a file

ada.integer_text_io.put(

file =>

item =>             );

 

creating output files

ada.text_io.create(

   file => ,

   mode => ,

   name =>             );

 

output files do not have to exist.

 

 

closing files

ada.text_io.close(

file =>      );