Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目前我正在写我的硕士论文,在 C++ 中遇到了一个小问题。在某些情况下,我必须重新启动 ntp 守护进程,因此我调用:
system("service ntp restart");
但是经过这个ntp监听的不是123端口,而是8377和8378。这个端口属于一个udp通道,在C++-prog中使用。
有人知道这种恶意行为吗?
谢谢 :)
system() 执行 shell 命令,这个 shell 命令的结果与 C++ 没有任何共同之处。你的问题绝对不是 C++ 而是 shell 脚本:
service ntp restart
请验证该命令的结果并检查命令环境,因为您很有可能需要设置环境变量。但所有这些 - shell 问题,而不是 C++ 问题。