Hello DEF.
Do you want the compiled C++ executable to wait for the FTP process to complete or to come back later and see what happened?
AFAIK, each system( ) call starts a new shell (which may or may not exit, depending on what you make it do); it's not like it there's one shell that you can keep dipping back into.
Thus you can't use
Code:
system("if [ $? -eq 0 ]; then\n do something\nfi")
to access the exit status from the preceding
Code:
system ("ftp -in 1.2.3.4 <<HERE\nuser username password\nput filename\nbye\nHERE&");
You need some inter-process communication between the process (tree) that you kick off from the compiled C++ executable to do the FTP work back to the compiled C++ executable. The simplest mechanism (conceptually and to debug) is to have the process (tree) doing the FTP work to write to a file and then read that file in the compiled C++ executable.
As with all asynchronous processes you need to time-coordinate between them; yes, you will have to "monitor the process" to see if it has finished before you can check how it went.
I don't C++ but guess the system() call returns the PID of the process it initiated. Presumably there's another function you can call from C++ to query a process by giving its PID. Beware the PID may be re-used!
Best
Charles