gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] Failure of StrToLongInt


From: rob solomon
Subject: [Gm2] Failure of StrToLongInt
Date: Tue, 15 Oct 2013 17:36:48 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

Consider this code:

MODULE TestLongIntConversion;
  IMPORT FpuIO,NumberIO,StrIO;
  FROM StrIO IMPORT WriteString, WriteLn, ReadString;

  VAR
    strlen : CARDINAL;
    LC      : LONGCARD;
    I         : INTEGER;
    LI       : LONGINT;
    s        : ARRAY [0..50] OF CHAR;

BEGIN

  LOOP
    WriteString(' Input line : ');
    ReadString(s);
    strlen := LENGTH(s);
    IF strlen = 0 THEN EXIT; END(*IF*);
    NumberIO.StrToInt(s,I);
    WriteString(' Int: ');
    NumberIO.WriteInt(I,0);
    WriteString(', LongInt: ');
    FpuIO.StrToLongInt(s,LI);
    IF LI = 0 THEN
      WriteString(' 0 has conversion failed.');
    ELSE
      FpuIO.WriteLongInt(LI,0);
    END;  (* LI = 0 *)
    WriteLn;

  END; (* reading loop *)
END TestLongIntConversion.

The FpuIO.StrToLongInt procedure always fails me.

Am I doing anything wrong?

--rob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]