Skip to content

Instantly share code, notes, and snippets.

@jvcleave
Last active December 10, 2015 20:08
Show Gist options
  • Select an option

  • Save jvcleave/4486538 to your computer and use it in GitHub Desktop.

Select an option

Save jvcleave/4486538 to your computer and use it in GitHub Desktop.
ping in c++
string deviceIP2 = "169.254.175.209";
string response = "";
char pipeBuffer[128];
FILE *pipe;
string command = "ping "+ deviceIP2;
pipe = _popen( command.c_str(), "rt" );
if( pipe )
{
while(fgets(pipeBuffer, 128, pipe))
{
ofLogVerbose() << "pipeBuffer: " << pipeBuffer;
response+=ofToString(pipeBuffer);
}
}
ofLogVerbose() << "COLLECTED OUTPUT IS: " << endl << response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment