how do I save ping results in a text file via c++?
Below is a copy of my code.
hrping here is an external program that works in a similiar manner as ping.

Any advice will be greatly appreciated.



#include <iostream>
#include <string>
#include <windows.h>

using namespace std;

static string host;
static string ping_again;

void ping()
{
int j,ep,k,ep1;
char wait1;
j=2;
k=2;

cout << "Host: ";
cin >> host;

for(ep=0;ep<j;e p++)
{

for(ep1=0;ep1<k ;ep1++)
{
system (("c:\\hrping-v238\\hrping.ex e " + host).c_str());


cout << endl;
}

}
cout<< "wait";
cin>>wait1;
}

int main()
{
SetConsoleTitle ("Ping in C++ by PVAMU");
ping();

return(0);
}