李若男和季枫的结局:system()函数的疑问

来源:百度文库 编辑:高考问答 时间:2024/05/01 12:29:29
/*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.*/