i think i am doing something wrong, but when in my perl i am asking for for user input, if this script is executed in nppexe console ..the line asking for input never appears on the screen ..i just get an empty screen waiting for input ..as soon as i enter the value ..the script runs and the value i entered gets assigned to my variable. If i run the same script from regular command prompt (windows) ..it works as it should. Here is sample of my code:
print "Enter your name:\n";
chomp ($name = <STDIN>);
print "Your name is" ,$name;
so when i run it in console i get this:
perl -w Helloworld.pl
John
Enter your name:
Your name is John
I have to enter my input first ..and only then it prints the line asking for name.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, you are right. This was tried to be solved, but without any results.
Alack, I did not find the way to force the StdOut/StdErr pipes to be read when the child process waits for user's input.
If you have any solution, please let me know.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the same happens with c when using scanf, something that worked for me is to put fflush(stdout); before every scanf in my code, hope this can be useful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
[regarding this problem and running executable files]
This is a known limitation. NppExec uses pipes to redirect the console input/output and, in your situation, nothing is read from the pipe until you enter something. The WinAPI function PeekNamedPipe just says there is nothing in the pipe and that's all, NppExec can not do anything with it.
So I recommend you to use NPP_RUN to run your application in its own (console) window.
I.e. your NppExec's script, in common case, will be similar to:
// compiling current file
gcc "$(FULL_CURRENT_PATH)" -o "$(CURRENT_DIRECTORY)\$(NAME_PART).exe"
// running the output .exe file
NPP_RUN "$(CURRENT_DIRECTORY)\$(NAME_PART).exe"
For more details, open NppExec's Console and type:
help
and press Enter.
[regarding the fflush()]
Yes, it is the real solution. The fflush() function forces the output to be printed, so the output can be read from the pipe right after fflush() was called.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello folks,
i think i am doing something wrong, but when in my perl i am asking for for user input, if this script is executed in nppexe console ..the line asking for input never appears on the screen ..i just get an empty screen waiting for input ..as soon as i enter the value ..the script runs and the value i entered gets assigned to my variable. If i run the same script from regular command prompt (windows) ..it works as it should. Here is sample of my code:
print "Enter your name:\n";
chomp ($name = <STDIN>);
print "Your name is" ,$name;
so when i run it in console i get this:
perl -w Helloworld.pl
John
Enter your name:
Your name is John
I have to enter my input first ..and only then it prints the line asking for name.
Yes, you are right. This was tried to be solved, but without any results.
Alack, I did not find the way to force the StdOut/StdErr pipes to be read when the child process waits for user's input.
If you have any solution, please let me know.
the same happens with c when using scanf, something that worked for me is to put fflush(stdout); before every scanf in my code, hope this can be useful.
[regarding this problem and running executable files]
This is a known limitation. NppExec uses pipes to redirect the console input/output and, in your situation, nothing is read from the pipe until you enter something. The WinAPI function PeekNamedPipe just says there is nothing in the pipe and that's all, NppExec can not do anything with it.
So I recommend you to use NPP_RUN to run your application in its own (console) window.
I.e. your NppExec's script, in common case, will be similar to:
// compiling current file
gcc "$(FULL_CURRENT_PATH)" -o "$(CURRENT_DIRECTORY)\$(NAME_PART).exe"
// running the output .exe file
NPP_RUN "$(CURRENT_DIRECTORY)\$(NAME_PART).exe"
For more details, open NppExec's Console and type:
help
and press Enter.
[regarding the fflush()]
Yes, it is the real solution. The fflush() function forces the output to be printed, so the output can be read from the pipe right after fflush() was called.