[fpc-pascal] How to split file of whitespace separated numbers?

greim greim at schleibinger.com
Sun Jan 1 17:48:16 CET 2017


Hallo Bo,

You are right. If you want to keep the numbers of one line together, 
then READ doesn't work for you.

Markus






Am 31.12.2016 um 12:18 schrieb Bo Berglund:
> On Sat, 31 Dec 2016 11:27:53 +0100, greim
> <greim at schleibinger.com> wrote:
>
>> Hallo Bo,
>>
>> please try the simple
>>
>> READ(myfile, x);
>>
>> as mentioned in my posting from 23.dec.
>> It works w/o any postprocessing.
>>
> I saw that but the problem is that there are varying number of items
> on each line and a line is considered a record.
> So I would anyway have to keep track of the lines.
> With Read I guess it skips all whitespace including line endings and
> this causes problems in identifying the content because of varying
> number of items on each line.
> The Readln approach followed by splitting in a stringlist is enough of
> an improvement that I can use it.
>
>




More information about the fpc-pascal mailing list