Home > Software engineering >  The results of the VB ping feedback with what judgment
The results of the VB ping feedback with what judgment

Time:11-30

VB inside how to judge the ping result is pass or not?

CodePudding user response:

https://www.baidu.com/s? Wd=vb6 + ping
Baidu is much more to go

CodePudding user response:

Fyi:
 # include & lt; Windows. H> 
#include
#include
Char YN (int k) {
The FILE * f;
Char fn [40].
Char ln [80].
Char yn;
int n;

Yn='N'.
Sprintf (fn, "d: \ \ % ping which xt", k);
F=fopen (fn, "r");
If (NULL!=f) {
n=0;
While (1) {
If (NULL==the fgets (ln, 80, f)) break;//
If (STRSTR (ln, "ms")) {
Yn='Y'
break;//
}
n++;
If (n>=4) break;//
}
The fclose (f);
}
Return yn;
}
Void main (int arg c, char * * argv) {
Char CMDSTR [256].
int i;
Int IP [3];
char c;

If (argc<2) {
USAGE:
Printf (" the Usage example: \ n % s 192.168.60. \ nto test 192.168.60.1-254 \ n ", argv [0]).
return;
}
If (4==sscanf (argv [1], "% d, % d, % d % c", & amp; IP [0], & amp; IP [1], & amp; IP [2], & amp; C)) {
If (0 & lt; [0]=IP & amp; & IP [0] <=255
& & 0<[1]=IP & amp; & IP [1] <=255
& & 0<[2]=IP & amp; & IP [2] <=255
& & '. '=={
c)for (i=1; i<255; I++) {
Sprintf (CMDSTR, "ping CMD/c % s % d - 1 - w n 1000 & gt; D: \ \ % ping which xt, "argv [1], I, I);
WinExec (CMDSTR, SW_HIDE);
}
Sleep (3000);
for (i=1; i<255; I++) {
Printf (" % d % c % s \ n ", YN (I), argv [1], I);
}
Sleep (3000);
Del WinExec (" CMD/c/q d: \ \ ping *. TXT ", SW_HIDE);
} the else goto the USAGE;
} the else goto the USAGE;
}
  • Related