【发布时间】:2014-02-24 12:55:01
【问题描述】:
我正在编写一个程序来 ping 一个 IP。
我必须 ping 1000s 的特定地址。
现在我想将 TTL 保存到一个文件中以绘制它的直方图。
我该怎么做?如何将 TTL 保存到文件中?
这是我尝试过的:
#include "stdafx.h"
#include "iostream"
#include "string.h"
#include "stdlib.h"
#include "conio.h"
#include <string>
#include <windows.h>
#include <iostream>
#include <fstream>
using namespace std;
static string host;
static string ping_again;
void ping()
{
cout << "Host: ";
host="www.yahoo.com";
system (("ping " + host).c_str);
}
int main()
{
ping();
return(0);
}
【问题讨论】: