Using pdb2gmx as a lib

GROMACS version: 2024.1
GROMACS modification: No

I intend to write a tool in C++ that allow to visually prepare a system for Gromacs.
I’m aware of the “gromacs as a lib” project. But my issue is to make it work with pdb2gmx and trjconv interactive command line input. (e.g. when you need to specify protonation states during pdb2gmx).

Thus, I resorted to use the shell to execute Gromacs commands, so I could deal with pdb2gmx and trjconv interactive command line behavior by reading what Gromacs write and writing into the input buffer.

I could make it work but I was wondering if there was a cleaner way to achieve it.
It is quite frustrating to get down to the shell to interact with another C++ program I’m compiling.