[fpc-pascal] String type with specified length and without codepage

Jonas Maebe jonas at freepascal.org
Sun Aug 18 12:09:53 CEST 2019


On 18/08/2019 11:57, Gabor Boros wrote:
> I do not want to fight with "char"s or "byte"s. Just want to use the
> easier way which have the best performance. (The original code use
> strncpy.) I can use "s_n:String[sn_len]", but "String" is ShortString
> and it's have CP_ACP codepage if I understand the wiki correctly. So I
> need a string type with explicit defined length and with CP_NONE
> codepage for a Linux/Windows multi platform application. Any idea?

That does not exist/is not supported. All strings have an associated
code page, because strings are data + interpretation of that data,
rather than just data. If you only want data, you have to use an array
instead (or a custom record with overloaded operators that uses an array
of char internally).


Jonas


More information about the fpc-pascal mailing list