[fpc-pascal] Adding file to string to the RTL
Michael Van Canneyt
michael at freepascal.org
Tue Oct 6 09:01:20 CEST 2020
On Mon, 5 Oct 2020, Ryan Joseph via fpc-pascal wrote:
>
>
>> On Oct 5, 2020, at 3:23 PM, Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>>
>> So I think you're looking at 6 or even 8 versions of this hypothetical function...
>
> Ouch. :)
>
> I'm sure this code already exists in the RTL though, right? I assume it's
> part of some classes like TStringList and we can just pull it up into a
> collection of functions which are easily searchable in the RTL docs.
Using TStringList would be a mistake, since it will parse your file while
there is no need.
No, I think that if you want this, it must be built from the basic calls.
>
> If not what is lowest level cross-platform layer which already exists and
> can we build up from? Maybe the "TextFile" type helps us? (I know it's
> ancient and I've never used it before honestly).
I don't think that would be a good strategy.
A simple filecreate, allocate buffer, fileread, fileclose will probably be easiest.
Michael.
More information about the fpc-pascal
mailing list