#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    1
    Rep Power
    0

    Question how to use Dos commands in Borlad C


    I want to make a small program in C language to whom when i run should Ping specific range of IP addresses on my LAN system.For example my range is from 192.168.0.41 to 192.168.0.59 so every time if i want to check the number of users online i need to pickup and dial at lab or secondly if phone is busy i use to Ping each IP address and it is very hectic.So i want to make a program to whom when i run should ping whole series of 18 IP and it will tell that number of users alive and dead.Secondly it will be more better if it also give me alive IP addresses.So please help me.Donot tell me to use IP Scanner i know many of them but i want to design my own small and simple.i donot need fency software i just need information about users. Please tell me how we can use Dos commands of Ping ,netstat,ipconfig in Borland C.:confused:
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Location
    Stavanger
    Posts
    83
    Rep Power
    14
    I'm not 100% sure this works with Borland C, but it works fine if you run it on a linux/unix system.

    The way I figure it you're in the need of calling some system calls to "shell" commands. Then you just run the function system(<commandname>); and the program will execute that command.

    Can't remember which library you need to include, but its one of the standard ones.

    Good luck!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Flint, MI
    Posts
    328
    Rep Power
    13
    If you're using C++ Builder (based on the Borland compiler), there is a convenient ICMP component included in the Professional version (possibly also in Basic). This will be better than shelling to a DOS command, because you'll have better access to the actual ping data.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development
    http://www.lazarusid.com/notes/

IMN logo majestic logo threadwatch logo seochat tools logo