What do you mean by mapping, what role does C/C++ play in your case? Are you saying that the message is constructed in Pascal and read in C? In that case the termination at 0 is no surprise.

Bastiaan.

On 03.09.2010 17:23, 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.  

 

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.