So as the title says, I would like to run a shell command on the same shell process/instance in C++ and communicate with it, how can I do that? I have looked up every corner and I couldn't find an appropriate/straight to the point answer. I am not a C++ overlord, my answer could be dumb. Now I could use a combination of fork/exec on unix, but I'm on windows. If there is a cross platform solution, please mention it below. Thanks in advance.
Pseudocode:
SHELL shell = make_shell();
shell.run("cd desktop");
shell.run("dir");
print(shell.stdout)