Jump to content

ping program

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Deathcry

Deathcry

    Learning Programmer

  • Members
  • PipPipPip
  • 68 posts
need help on it any would be appreciated. so far everything runs but the system() doesent actually do the "ping"

heres the code


#include <iostream>

#include <fstream>

using namespace std;


int main () {

    double pinged;

    string pingstuff, sendstring, info;

    char buffer[50];

    

    

    cout << "Enter Website: ";

    cin.getline(buffer, 50);

    pingstuff = buffer; 

    

    info = system(sendstring.c_str());

    info;

    

    

    sendstring = "ping " + pingstuff;

    ofstream myfile;

    myfile.open ("save.txt");

    myfile << "pinged sites are "; 

    myfile << info;

    myfile.close();

    system("PAUSE");

    return EXIT_SUCCESS;

}



#2
Deathcry

Deathcry

    Learning Programmer

  • Members
  • PipPipPip
  • 68 posts
any1 help?

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It looks like you're making the system call before defining where to ping.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
Deathcry

Deathcry

    Learning Programmer

  • Members
  • PipPipPip
  • 68 posts
thanks alot dude. it works now