I have developed an application in Linux using C language which has command line interface. It is completely an independent application. Now I am making a GUI interface for it also in C using gtk library. In CLI, before a certain operation, my CLI application waits for a password (just like they do it in useradd command line utility in linux). For this purpose I will create a window with password field asking for password in GUI.
My question is that how will I transfer the password from GUI to the application that is waiting for password in CLI? Can I redirect the password taken from GUI to the stdin of CLI process?
Also please let me know if my approach is correct or what are the standard ways of doing it?
Any help would be appreciated.