我的exe文件没有通过任何日志文件(jampded.exe) [英] My exe does not pass anything to logfile (jampded.exe)
问题描述
我要创造我的游戏服务器的简单处理程序。它会直接读取控制台,并采取我想任何行动。但!我无法从服务器到我的exe或txt的传递输出。
I want to create a simple handler for my game server. It will read the console directly and take any action i want. BUT! I can't pass the output from the server to my exe or txt.
ping google.com > ping.log
它工作得很好,一切都将在我的日志文件中记录。此外,我创建了一个exe文件,能够读取输出数据是这样的:
It works fine, everything will be logged in my log file. Also I created an exe, that can read the output data this way:
ping google.com | my.exe
这也工作得很好,我的exe文件的内容是:
It also works fine, my exe's content is:
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
string input = "";
while(cin) {
getline(cin, input);
cout << input << endl;
};
system("pause");
}
它显示样样在行线。
It shows everything line by line.
问题与jampded.exe。如果我有一个批处理文件启动它,它在控制台窗口输出,但我不能接受这对于我的日志文件,或my.exe。我不知道。
The problem is with the jampded.exe. If I start it with a batch file, it has output in the console window, but I can not pass this for my log file, or my.exe. I have no idea.
我把COUT,在我的code,所以它显示了它在while循环stucking。函数getline等待CIN,但没有通过。但是,为什么?
I put cout-s in my code, so it shows it is stucking in the while loop. getline waits for cin, but nothing passed.. But why?
推荐答案
我不熟悉jampded,但通常情况下,服务器将输出一些启动消息到控制台,然后从控制台输入/输出分离本身,所以它可以在后台运行。任何进一步的消息可以被写入日志文件中。
I am unfamiliar with jampded, but normally, a server will output some start messages to the console, and then detach itself from the console input/output, so it can run in the background. Any further messages may be written to a log file.
这是可能的,你可以通过命令行或配置文件的选项开始jampded继续写作到控制台。或者你可以读取日志文件。 (对于我通常使用tail.exe -f由GnuWin32文件utils的。)
It is possible that you can start jampded with command line or configuration file options to keep writing to the console. Or you could read the log file. (For which I normally use "tail.exe -f" from the gnuwin32 file utils.)
在谷歌快速搜索还表明,有一个非专用的服务器版本,称为jamp.exe。用于测试的目的,可以提供更多的灵活性,捕获输出
A quick search on google also shows that there is a non-dedicated server version called jamp.exe. For testing purposes it may offer more flexibility to capture the output.
这篇关于我的exe文件没有通过任何日志文件(jampded.exe)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!