ada Files and I/O streams Create and write to file


Example

The procedures Create, Put_Line, Close from the package Ada.Text_IO is used to create and write to the file file.txt.

with Ada.Text_IO;

procedure Main is
   use Ada.Text_IO;
   F : File_Type;
begin
   Create (F, Out_File, "file.txt");
   Put_Line (F, "This string will be written to the file file.txt");
   Close (F);
end;

Resulting file file.txt

This string will be written to the file.txt