Input and Output of REAL Data

Newcomers to Astrobe and Oberon are welcome to ask any beginner-level questions here
Post Reply
anitasure123
Posts: 22
Joined: Tue Jul 21, 2015 6:49 am

Input and Output of REAL Data

Post by anitasure123 » Thu Jul 30, 2015 11:24 am

Hello There,

I got the problem when dealing with REAL type data types like when using In.Real and Out.Real(Error – Undefined, but even Reals file is present in Astrobe\Lib\General folder).

Please reply,
Thanks
Anita

cfbsoftware
Site Admin
Posts: 423
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Input and Output of REAL Data

Post by cfbsoftware » Thu Jul 30, 2015 12:09 pm

The In and Out library modules do not have a procedure called Real. Refer to Chapter 3 Library Modules in Help > Oberon for Cortex-M3 Microcontrollers to see the definitions of all the procedures contained in the library modules.

If you want to input / output REAL data you need to input / output them via strings, using the procedures in the library module Reals to convert strings to REALs and vice-versa. e.g. the following procedure is taken from the Extensions module in the General Examples folder:

Code: Select all

PROCEDURE OutReal(r: REAL);
VAR
  s: ARRAY 32 OF CHAR;
BEGIN
  Reals.RealToStrF(r, 7, s);
  Out.String(s)
END OutReal;

Post Reply