I want to rewrite a code to windows
In Unix setting, I use a FILE pointer and open the pipe to run the forced command. It is like the following:
Code:
#define cmd 
"ssh -i /home/keys/student user@172.16.57.145 > /home/output/getip.out"

FILE *fp;
fp = popen(cmd, "w");
fprintf(fp, "getip\n");
flush(fp);
I think it is a bit hard in Windows because the path is extremely complicated. Plus, I just use system(). How can I have the info return to my pipe? The following is my not working version, but you probably can see my thought:
Code:
#define cmd 
"C:\\ok\\plink.exe -i C:\\ok\\keys\\student.ppk user@172.16.57.145 > C:\\ok\\output\\getip.out"

FILE *fp;
system(cmd);
I don't know how to have the info post to my getip.out