<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>> Since I'm writing the command to a pipe, there's no need for a file [...]</div>

<div> </div>

<div>Sorry, I got confused here.  Of course, "write" writes to a file and I changed this accordingly in my C++ code.  On the other hand, I could use a named pipe (a.k.a. "fifo") and I probably will, so as not to have to delete the file, which doesn't need to be kept.
<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Freitag, 21. Januar 2022 um 11:18 Uhr<br/>
<b>Von:</b> "Laurence Finston" <Laurence.Finston@gmx.de><br/>
<b>An:</b> "luigi scarso" <luigi.scarso@gmail.com><br/>
<b>Cc:</b> "MetaPost List" <metapost@tug.org><br/>
<b>Betreff:</b> Aw: Re: [metapost] Problem with showing paths</div>

<div name="quoted-content">
<div style="font-family: Verdana;font-size: 12.0px;">
<div>
<div>> not with "double" but with "decimal" and "binary" we have numberprecision:</div>

<div>>  [...]:</div>

<div>> decimal and binary are slower than double, btw.</div>

<div> </div>

<div>Thanks.  decimal or binary should do it.  Speed isn't an issue.</div>
</div>

<div>
<div> </div>

<div>> I think this is the right way, not a workaround: write your data to a file , post-process the file with, for example, perl.</div>

<div> </div>

<div>Since I'm writing the command to a pipe, there's no need for a file and I'm using Flex.  Under other circumstances I would use gawk, but there are any number of ways of solving this problem. </div>

<div> </div>

<div>I make all of this sort of thing available anyway, but it might be useful for others with similar problems to see this example (when it's finished).</div>

<div>I'm not sure how they would find out about it, though. </div>

<div> </div>

<div>At any rate, the code for the scanning function is here:</div>

<div><a href="https://git.savannah.gnu.org/cgit/3dldf.git/tree/src/scnmptpt.web" target="_blank">https://git.savannah.gnu.org/cgit/3dldf.git/tree/src/scnmptpt.web</a></div>

<div>
<div>It doesn't work yet, but should in the next day or two.</div>

<div>The file with the macros (only the one so far) is here:</div>

<div><a href="https://git.savannah.gnu.org/cgit/3dldf.git/tree/src/writemcs.mp" target="_blank">https://git.savannah.gnu.org/cgit/3dldf.git/tree/src/writemcs.mp</a></div>

<div>I will be adding at least a macro for numerics and possibly ones for other data types.</div>

<div> </div>

<div>I may just use Werner's solution for increasing the line length.  However, if there's no guarantee that the format of the output of "show" won't change, it may be safer to use the macro.  In addition, I can avoid skipping over the strings MP writes to its output that I don't need.</div>

<div> </div>

<div> </div>

<div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b> Freitag, 21. Januar 2022 um 09:20 Uhr<br/>
<b>Von:</b> "luigi scarso" <luigi.scarso@gmail.com><br/>
<b>An:</b> Kein Empfänger<br/>
<b>Cc:</b> "MetaPost List" <metapost@tug.org><br/>
<b>Betreff:</b> Re: [metapost] Problem with showing paths</div>

<div>
<div>
<div> </div>
 

<div class="gmail_quote">
<div class="gmail_attr">On Fri, Jan 21, 2022 at 8:43 AM Laurence Finston <<a href="mailto:Laurence.Finston@gmx.de" onclick="parent.window.location.href='mailto:Laurence.Finston@gmx.de'; return false;" target="_blank">Laurence.Finston@gmx.de</a>> wrote:</div>

<blockquote class="gmail_quote" style="margin: 0.0px 0.0px 0.0px 0.8ex;border-left: 1.0px solid rgb(204,204,204);padding-left: 1.0ex;">For a particular application, I'm calling MP from within a program via a pipe and I want to read the output and use it for setting variables in my application.  The intention is to use "point x of <path>" to take a path of length n and convert it into an equivalent path of length n*m where m is some whole number > 1 (within reason).<br/>
<br/>
The problem is the way the lines in the output of "show" are broken:  The lines are fairly short (max. 80 characters, including the newline) and the x- and y-coordinates of the points can be broken across two lines, which makes parsing unnecessarily difficult.</blockquote>

<div> </div>

<div>yes, it is a "feature". We have to deal with it.</div>

<div> </div>

<blockquote class="gmail_quote" style="margin: 0.0px 0.0px 0.0px 0.8ex;border-left: 1.0px solid rgb(204,204,204);padding-left: 1.0ex;"> </blockquote>

<blockquote class="gmail_quote" style="margin: 0.0px 0.0px 0.0px 0.8ex;border-left: 1.0px solid rgb(204,204,204);padding-left: 1.0ex;">It would also be nice to limit the number of decimal places for the coordinates, by rounding or even by truncating.<br/>
 </blockquote>

<div> </div>

<div>not with "double" but with "decimal" and "binary" we have numberprecision:</div>

<div>if numbersystem="decimal":</div>

<div> numberprecision:=6;<br/>
fi<br/>
if numbersystem="binary":<br/>
 numberprecision:=6;<br/>
fi</div>

<div> </div>

<div>decimal and binary are slower than double, btw.</div>

<div> </div>

<blockquote class="gmail_quote" style="margin: 0.0px 0.0px 0.0px 0.8ex;border-left: 1.0px solid rgb(204,204,204);padding-left: 1.0ex;">As a workaround, I've written a macro to write the data I need to a file (see attachment), but it would be nicer if "show" could be used instead.<br/>
 </blockquote>

<div> </div>

<div>I think this is the right way, not a workaround: write your data to a file , post-process the file with, for example, perl.</div>
</div>

<div> </div>
--

<div class="gmail_signature">luigi</div>
</div>
-- <a href="http://tug.org/metapost/" target="_blank">http://tug.org/metapost/</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>