I have a script named stdout.wl:
While[True, Pause[0.001]; WriteString[OutputStream["stdout", 1], RandomInteger[]//ToString//(#<>"\r\n")&]]
I have another script named stdin.wl:
While[True, Pause[0.001]; Print[InputString[]]]
Run them in commandline:
WolframKernel -script stdout.wl | WolframKernel -script stdin.wl
It works well, the terminal prints those random integers generated from the first script to the second one.
Now I want to remove the \r\ns from the stdout.wl:
While[True, Pause[0.001]; WriteString[OutputStream["stdout", 1], RandomInteger[]//ToString]]
I wonder how should I change the stdin.wl to make this work again:
While[True, Pause[0.001]; Print[(*somefunction[]*)]]
I've tried the answers under
But none of them works.
Thanks.
StringTrim[...]orStringReplace[..., "\r\n" -> ""]? – flinty Sep 10 '20 at 11:59stdout.wl, I need to read them usingstdin.wl. Is not about reading those\r\nand remove them later. – kenkangxgwe Sep 12 '20 at 03:29wolfram.exe -script stdout.wl | wolfram.exe -script stdin.wlinstead? RunningWolframKernel.exewill open up a GUI window which is not desired. – kenkangxgwe Sep 12 '20 at 03:31(*somefunction[]*)comment so it can print the output of stdout.wl – kenkangxgwe Oct 01 '20 at 06:19