i know that fstream allows communication with a file. is there an equivalent class that would allow me to communicate likewise with the ftp program provided by UNIX.
what i'm trying to do is write a program that acts as an interface to ftp. it grabs info from a file, and then manipulates the ftp program accordingly. meanwhile, i don't want anything printed on screen. so i want to execute "ftp", and then get the response "ftp>" into a variable, and check it, then send back "open", and expect the response "(to):"...and so on.
i've tried using C function:
but the problem with this is that i need to read back the response, i.e. "ftp>" when i send "ftp". and i can get "ftp>" with something like: fgets, but fgets doesn't know when to stop reading because after "ftp>" nothing would be sent because ftp is waiting for a command, but fgets doesn't know that and it keeps trying to read. i think i need to read nonblocked data or something.....not too sure.
anyway, help =) a C++ solution that replaces the use of popen() would be most appreciated, and preferred. but any other solution is welcomed.