Null characters (& string implementation) in gpc

Morton, John John.Morton at navcanada.ca
Fri Sep 3 17:23:18 CEST 2010


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.  

 

We have not found a pure (Pascal-only) way to use gpc writeln (etc.)
statements to send strings that must include null characters (in our
case as part of a 4 byte binary time).  The problem is that the
implementation of the mapped C/C++ function prematurely terminates a
message at the null, preventing the message from being transmitted
properly. 

The impact on us is that whenever any byte of the time rolls over a
service outage results - with the length of the outage depending upon
which byte rolls over.  We have since kluged a way around the issue but
would much prefer a pure Pascal (=portable) solution. 

In our case the message must be sent as one complete entity, meaning
separating the string into multiple "writeln" statements is not
possible. (This would be an awkward approach if/when (multiple) nulls
can appear anywhere in the string).

 

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?  

 

Any ideas out there about how to do this?

 

Thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.g-n-u.de/pipermail/gpc/attachments/20100903/3c48c435/attachment.htm>


More information about the Gpc mailing list