I was making a GUI application to manage users and groups in Linux! 

I'm done with the part where it creates a new user, but stuck with the part where it gives the newly created user a new password.
What my app simply does is to take the required input (username, list of groups, and password) through a GUI and runs a script passing this info as argument.
Let's say we have a user account, xyz.
If I want to change the password for this account, then all I need to do is simply run the command:

```
passwd xyz

```

This will ask for new password. Now I can create a new account using scripts because all the required info is passed in the command line.

```
useradd -m -G users -g "groups" -s /bin/bash "UserName"

```

I can run a script through Qt app and create the user, but
in `passwd cmd`, the input is asked in the other line. How does one deal with that?