[Lazarus] RE : reading FORTRAN-style input in Lazarus

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Fri Aug 5 19:48:59 CEST 2011


Ludo Brands wrote:
>> sscanf's like constructs are also a possibility. ARRAY OF 
>> CONST is strong enough to implement it.
>>  
> 
> The Fortran output is fixed format. In
> FORMAT(I3,I7,2X,A25,1X,F6.2,1X,F7.2,3(1X,I4),1X,F4.1,1X,I1) the first 2
> integers can be linked together. 123 followed by 1234567 result in
> 1231234567. sscanf can't deal with this AFAIK.

Couldn't a function e.g. FortranCard() take a dynamic array of format 
specifiers and return a dynamic array of variants? Then

   values := FortranCard(stream, ['I3', 'I7', '2X', 'A25', ...

is simply a case of splitting the input into fixed-length fields, the 
letters being "noise".

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list