redirect console output to a String?
I am new to C and am writing a small application in C. One part of it is to fire some system commands and store the output in some variable.
A small example of what i wanna do:
now i want to store the output of system() in a string (or an array of String). I tried out many things but nothing seems to work.
return system("ifconfig | grep 'inet addr'");
Will be very happy if somebody could help me out in this :)
*** stack smashing detected ***
Does anybody has some idea why this piece of code
is generating the following error
int setIP(char fName)
char cmd = "vmware-cmd ";
char var = " setguestinfo ip 220.127.116.11";
if (( pipein_fp = popen(cmd, "r")) == NULL)
while(fgets(readbuf, 100, pipein_fp))
printf("Server IP for VM set successfully");
setguestinfo(ip 18.104.22.168) = 1
*** stack smashing detected ***: ./TCPEchoServer terminated
Server IP for VM set successfullyAborted (core dumped)