VC 控制台 system命令
#include <stdlib.h>
#include <iostream.h>
void main()
{
char cmd[128];
while(1)
{
cout<<"输入CMD命令\\>";cin>>cmd;
system(cmd);
}
}
这是实现像CMD一样的功能,可是当我输入ping 10.1.181.1时,它显示
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
[-r count] [-s count] [[-j host-list] | [-k host-list]]
[-w timeout] target_name
Options:
-t Ping the specified host until stopped.
To see statistics and continue - type Control-Br
To stop - type Control-C.
-a Resolve addresses to hostnames.
-n count Number of echo requests to send.
-l size Send buffer size.
-f Set Don't Fragment flag in packet.
-i TTL Time To Live.
-v TOS Type Of Service.
-r count Record route for count hops.
-s count Timestamp for count hops.
-j host-list Loose source route along host-list.
-k host-list Strict source route along host-list.
-w timeout Timeout in milliseconds to wait for each reply.
'10.1.181.1' 不是内部或外部命令,也不是可运行的程序
或批处理文件。