Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 30 lines (24 sloc) 0.603 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
-- Simple Ada program to read "itself" (the file it's compiled from)
-- and print it out
--
--
with Ada.Sequential_IO;
with Ada.Text_IO;

procedure readself is
    package IO is new Ada.Sequential_IO(Element_Type => Character);
    SourceFile : IO.File_Type;
begin

    Ada.Text_IO.New_Line;
    IO.Open(SourceFile, IO.In_File, "readself.adb");

    declare
        C : Character;
    begin
        while not IO.End_Of_File(SourceFile)
        loop
            IO.Read(SourceFile, C);
            Ada.Text_IO.Put(C);
        end loop;
    end;

    IO.Close(SourceFile);
    Ada.Text_IO.New_Line;

end;
Something went wrong with that request. Please try again.