how to read string from stdin and write to stdout?
how to read string from stdin and write to stdout?
I tried width console input and printn but it is not working.
Registered user of PB (on Linux Mint 21.1 & Win 10 64bit)
Re: how to read string from stdin and write to stdout?
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: how to read string from stdin and write to stdout?
I read it but do not understand. I have to run program A and connect to it in connect, read & write mode?
What I want is:
program A spawns my program (B)
program A sends string to stdin of B
program B reads string from stdin
after each string program B sends string to stdout
program A receive data and send new string....
ps: i wrote squid url rewriter. A is squid (own by root) and B is my program.
What I want is:
program A spawns my program (B)
program A sends string to stdin of B
program B reads string from stdin
after each string program B sends string to stdout
program A receive data and send new string....
ps: i wrote squid url rewriter. A is squid (own by root) and B is my program.
Registered user of PB (on Linux Mint 21.1 & Win 10 64bit)
Re: how to read string from stdin and write to stdout?
I wrote small test program in win and nt port of squid. Input() is reading string from stdin but I can not figure what is (or do not know how to writeprogramstringn() ) writing to stdout.
Registered user of PB (on Linux Mint 21.1 & Win 10 64bit)
Re: how to read string from stdin and write to stdout?
You can use ReadProgramString() and WriteProgramString() if your program launch the subprocess. Then your child program can use PrintN() and Input()
Re: how to read string from stdin and write to stdout?
Thx 4 try but my program (B) is called by another (A).
From my testing in Windows for now... printN() is writing to stdout.
I change code a little bit and it works on Windows.
I will recompile in ubuntu 32bit later. Maybe problem is ownership (program A is own by root).
From my testing in Windows for now... printN() is writing to stdout.
I change code a little bit and it works on Windows.
I will recompile in ubuntu 32bit later. Maybe problem is ownership (program A is own by root).
Registered user of PB (on Linux Mint 21.1 & Win 10 64bit)
Re: how to read string from stdin and write to stdout?
Solved! I enabled threadsafe compiler option.
Registered user of PB (on Linux Mint 21.1 & Win 10 64bit)
- Joakim Christiansen
- Addict

- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
Re: how to read string from stdin and write to stdout?
What's annoying about this is that you have to open a console window first! (at least on Windows)Fred wrote:You can use ReadProgramString() and WriteProgramString() if your program launch the subprocess. Then your child program can use PrintN() and Input()
It would be a good idea to be able to write to stdout without the program opening a console window first.
EDIT: Okay, I spoke too soon... #PB_Program_Hide solves my problem!
I like logic, hence I dislike humans but love computers.


