

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


(15 respondents)
The Ada Style Guide says the following: http://www.iste.uni-stuttgart.de/ps/ada- doc/style_guide/sec_3a.html#3.
Ada.Text_Io.Create (File_Word,Ada. Text_Io.Out_File, "my_file.doc");
This will only create a file of the given name and extension. The format however is controlled by the user (also see 3 and 4).
Are these files the same sort of files that we wrote in Microsoft Notepad and used in the beam lab or do you have to create all your files in Ada? No you don’t have to create all the files in Ada. For the beam lab, you created files using notepad and knew the format with which the data was stored. This allowed you to read the data in the files and write into the files with the required format.
Can you save text to any program (i.e., word or excel)? There are two interpretations to this question: a. Can I directly send the contents of the file to a word or excel program that is already running? Yes, provided you understand the communication mechanisms
between the different programs. Cut and Paste operations work across Word, Excel and Powerpoint through a mechanism called OLE (object linking and editing). You can use a similar mechanism for your Ada program to talk to another program.
b. Can I create a file that can be read by another program? Yes, if you know the details of naming convention for the program (e.g., .doc .xls) and all the details of how data is represented by the other programs, you should be able to create files that can be read and manipulated by them.
Create(Numbers,Out_File, "C:\Documents and Settings\Kristina\My Documents\Undervisning\Unified 03-04\Spring 2004\Ada\3\INTDATA.TXT"); Create(Some_Text, Out_File, "TEST.TXT"); Create(More_Text, Out_File, "CHARACTS.TXT");
And the file INTDATA.TXT would have been created in the folder “3” on my computer, and the other two files are created in “the current folder”.
Is standard_Output always to the monitor (assuming we do not change defaults)? Calls using Standard_Output as the file are routed to the device that the operating system considers to be standard_output. In the case of most computing systems which have some form of human interaction, the standard output is the monitor (terminal in unix jargon). Often times for embedded systems, it is a log file which can be analyzed during maintenance.
Do we need two separate commands to output the same data to standard_output and to file? Yes. As far as Ada is concerned, standard_output is also an external file. Since you want to write to two files, you will need two separate subprogram calls.
If every input or output of your program is a file, including user input, is there a way to preserve this “file” without explicitly storing each line of input? Interesting question. It is possible to create an area in memory where every interaction of your program is stored, which can later be analyzed, converted into a file, or simply ignored. As the number of interactions between the program and the external environment grows, the amount of memory needed to log all the operations increases, which then becomes a bottleneck on the systems performance.
Could you explain: type My_Fixed is delta 0.01 range 20.0 .. 42.0; just a type of numbers 20.0, 20.01, 20.02,?