<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 17, 2020 at 1:18 PM Schmitz, Uwe <<a href="mailto:uwe.schmitz@bezreg-koeln.nrw.de">uwe.schmitz@bezreg-koeln.nrw.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Roger,<br>
<br>
You didn't post sample code, so I only can guess some things.<br>
In addition, you haven't written what you have tried so far,<br>
so maybe the following is not unknown to you.<br>
<br>
First, I suppose that you set up a pipe to cs2cs like:<br>
<br>
set fid [open "|cs2cs" r+]<br></blockquote><div><br></div><div>Pretty much.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Second, to send line by line to the pipe you should do<br>
<br>
chan configure $fid –buffering line<br></blockquote><div><br></div><div>This is also done. That's why cs2cs reads the first line I send. It is not buffered out from tcl. <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Finally, you have to make sure that the output is not buffered.<br>
I assume that cs2cs buffers its output. That seems to be your problem,<br>
I guess. You can verify this by sending say 10000 or more transformation <br>
lines to the pipe. At some point cs2cs may flush its output and you will see<br>
it by reading the pipe.<br>
IMHO, there is no way to prevent cs2cs from buffering.<br></blockquote><div><br></div><div>I think that's the case. So, I have made my own program for doing this. And it works. I was just hoping to use an existing program instead of reinventing the wheel.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
But... under Linux you can try unbuffer:<br>
<a href="https://linux.die.net/man/1/unbuffer" rel="noreferrer" target="_blank">https://linux.die.net/man/1/unbuffer</a><br>
<br>
E.g.:<br>
set fid [open "|unbuffer cs2cs" r+]<br></blockquote><div><br></div><div>I did not know about this program. I don't see how it can make cs2cs change it's behavior.</div><div>  <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If you really consider using the bare C-Api, I recommend <br>
using the great Ffidl package:<br>
<br>
<a href="https://wiki.tcl-lang.org/page/Ffidl" rel="noreferrer" target="_blank">https://wiki.tcl-lang.org/page/Ffidl</a></blockquote><div><br></div><div>We already use the C API in a library that simplifies access to proj for our use. I will actually be using that in the program.</div><div><br></div><div>I wonder how one defines proj data structures in a useful way for Ffidl. That seems like an interesting task. We have done similar things with SWIG. I'm not a fan of how SWIG accesses shared data structures in tcl. So we have usually written our own C interface between Tcl and the rest of the world as needed. Mainly because of tracking changing data structures (the C/C++ ones).</div><div><br></div>Thanks for the information!<br clear="all"></div><br>-- <br><div dir="ltr" class="gmail_signature">Roger Oberholtzer</div></div>