Null characters (& string

Frank Heckenbach ih8mj at
Fri Sep 3 23:16:10 CEST 2010

Morton, John wrote:

> We have encountered an unexpected implementation issue with gpc, one
> that probably affects all languages implemented using C/C++:  The
> mapping of Pascal writeln (etc.) statements to "equivalent" C/C++ string
> handling code.  

Others have replied already, but I can confirm that GPC does not use
printf etc. internally to implement WriteLn, if that's what you

> Stated more generally, is there a pure gpc Pascal way to send
> ("writeln") strings that can contain any/all of the 256 8 bit characters
> (especially the null) - an approach that does not require retyping our
> string definitions?  

Of course, any such way is not pure Pascal in the sense of ISO
Pascal or so. Text files (WriteLn) are not really meant for binary
data, though it works with GPC, and is as portable as GPC is, and
probably works with some other compilers as well. The official
Pascal way would be a "file of Char" (though ISO Pascal doesn't even
guarantee that the NUL character is part of the character set),
where you'd need to read/write every character individually.


Frank Heckenbach, f.heckenbach at,, 7977168E
GPC To-Do list, latest features, fixed bugs:
GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE  D101 CD02 4C9D 0FE0 E5E8

More information about the Gpc mailing list