Hello all,
Iam trying to save the ping results obatined in a text file in c++.
Below is a copy of my code. Any advice will be greatly appreciated.
I keep getting this error:
c_str()) was unexpected at this time.
Iam trying to save the ping results obatined in a text file in c++.
Below is a copy of my code. Any advice will be greatly appreciated.
I keep getting this error:
c_str()) was unexpected at this time.
Code:
#include <iostream> #include <string> #include <windows.h> using namespace std; static string host; static string ping_again; void ping() { int j,ep; char wait1; j=2; cout << "Host: "; cin >> host; for(ep1=0;ep1<k;ep1++) { system ("(ping + host).c_str()) >> myfile.txt "); //system("dir > myfile.txt"); cout << endl; } cout<< "wait"; cin>>wait1; } int main() { SetConsoleTitle("Ping in C++ by india215"); ping(); return(0); }
Comment