thank you both for your suggestions.
RE: i can't use shell scripting because i must doi it in c (it's just i small part of a more complex project i have to make for school. ).
i found that i can build my string outside the "system" function and than use it in "system".
it's something like this:
Code:
char file[20]=" >>output_file.txt";
for (i=1;i<=n;i++)
{char string[200]="ping c -1 ";
strcat(string,ip[i]);
strcat(string,file);
system(string);}
// ip[i] = an element from my vector of IPs
the output of each ping it's appended to output_file.txt
this is just an example....