黄子华神秘宝藏百度云:system()函数的疑问

来源:百度文库 编辑:中科新闻网 时间:2024/05/15 13:22:40
/*system()函数的疑问
今有以下程序:*/
#include "stdio.h"
main()
{
char ip[15];
scanf("%s",&ip[15]);
system("ping %s",ip[15]);
}
/*我需要调用system()函数并用ping命令来
检测用户所输入的ip地址.但system()函数并不支持
附加.希望高手能帮忙解答以下用什么可以实现我得需要.谢谢!
在dev C++中能通过,但结果明显错误:
127.0.0.1
Ping request could not find host %s. Please check the name and try again.*/