Pipe Managed FTP Client in C

I am trying to control the ftp client from a C program (OS X). I did fork and execve - the process started fine. The problem is that with pipes - I can send a command to the ftp client process and get feedback from it simply (if I send "help \ n", I will return to the help output), but what I never get in the handset is "ftp>". Any ideas?

Ivan

+3
source share
3 answers

The program can check stdinto see if it is a terminal or a pipe. In your case, the FTP program probably does this (for example, to find out if it can use escape sequences to display progress bars or suggest editing the command line).

If you really need a hint, you should study the PTYs (pseudo-terminals) that emulate the console.

+1
source

ftp-, , -, stdin/stdout - - ( , C -). , , . ( , expect, , ).

+3

wild guess: is this not a "ftp>" message written in STDERR?

0
source

Source: https://habr.com/ru/post/1734848/


All Articles