3

I know, it's a noob question but..... I don't know :(

I am using dotnet-gnat, I'm having trouble using the commands of the platform. Net in Ada ... I can use the WriteLine, but the ReadLine command, I can not .... How to know the correct way to use some command?

My code:

with Ada.Text_IO, MSSyst.Console;
use  Ada.Text_IO, MSSyst.Console;

procedure ada_net is
begin
    Put("Ola mundo");
    New_line;
    WriteLine("Ola mundo");
    --ReadLine;
end ada_net;

ReadLine code:

function ReadLine  return access MSSyst.String.Typ'Class;
pragma Export (CIL, ReadLine, "ReadLine");

Thanks.

Alexandre
  • 1,985
  • 5
  • 30
  • 55
  • 5
    I've not worked with .Net, but I can tell you right away that since ReadLine is a function it needs to be invoked as one. You need to have a variable of a type compatible with ReadLine's return type and assign the result of the invocation of ReadLine to it. – Marc C Nov 15 '11 at 19:38
  • confusing Import with Export? – Rommudoh Nov 16 '11 at 07:35

1 Answers1

2
with
MSSyst.String,
MSSyst.Console,
Ada.Text_IO;

procedure Test is
begin
   Ada.Text_IO.Put_Line( "Dotnet test." );
   Ada.Text_IO.Put( "Enter a line: " );
   declare
      Line : access MSSyst.String.Typ'Class renames MSSyst.Console.ReadLine; --'

      use MSSyst.String;
      Function "&"( Left, Right : access Typ'Class ) return access Typ'Class renames Concat;
      Function "&"( Left : String; Right : access Typ'Class ) return access Typ'Class is
        ( (+Left) & Right );
   begin      
      MSSyst.Console.WriteLine( ("You entered: """ & Line) & (+(1=> '"')));
   end;
end Test;
Shark8
  • 4,095
  • 1
  • 17
  • 31