|
![]() | 作者: cyshaoping [cyshaoping]
![]() |
登录 |
我在运行下面这个的时候为什么说 系统发生 53 错误。 找不到网络路径。 我在cmd里面执行: net use \\10.1.0.195\ipc$ "" /user:"user" 提示成功,我怀疑 ipc="net use \\\\ip\\ipc$ \"\" /user:\"user\""; 这句错了,到底错在哪里呢?请指点一下! //test.h #include "iostream.h" #include "process.h" class net { private: char * ip; char * ipc; char * yingshe; public: void setip(char*); void netuse(); }; void net::setip(char* myip) { ip=myip; } void net::netuse() { ipc="net use \\\\ip\\ipc$ \"\" /user:\"user\""; yingshe="net use z: \\\\ip\\c$"; system(ipc); system(yingshe); } //test.cpp #include "test.h" main() { net obj; obj.setip("10.1.0.195"); obj.netuse(); return 0; } |
地主 发表时间: 10/23 14:27 |
![]() | 回复: 286 [unique] ![]() |
登录 |
ipc="net use \\\\ip\\ipc$ \"\" /user:\"user\""; system(ipc); 执行的是:net use \\ip\ipc$ "" /user:"user" 而不是:net use \\10.1.0.195\ipc$ "" /user:"user" 改正如下: ==================================================== #include <process.h> #include <stdio.h> class net { private: char * ip; char ipc[100]; char yingshe[100]; public: void setip(char*); void netuse(); }; void net::setip(char* myip) { ip=myip; } void net::netuse() { //ipc="net use \\\\ip\\ipc$ \"\" /user:\"user\""; //yingshe="net use z: \\\\ip\\c$"; sprintf((char *)ipc,"net use \\\\%s\\ipc$ \"\" /user:\"user\"",ip); sprintf((char *)yingshe,"net use z: \\\\%s\\c$",ip); system(ipc); system(yingshe); } main() { net obj; obj.setip("10.1.0.195"); obj.netuse(); return 0; } |
B1层 发表时间: 10/23 15:36 |
![]() | 回复: cyshaoping [cyshaoping] ![]() |
登录 |
明白了 谢谢 |
B2层 发表时间: 10/23 15:46 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号