jEdit Community - Resources for users of the jEdit Text Editor
Problem with Console Plugin and stdin
Submitted by LordKelvan on Wednesday, 7 December, 2005 - 05:26
Hi, I have the latest version of the Console plugin (4.1.2). After reading some posts in this forum, it seems that versions of the plugin after 4.1 should support stdin (i.e. it allows for user keyboard input when running c programs). However, when I try to run a simple C program which asks the user a few questions in the System Shell of the Console plugin, it doesn't work properly. What happens is the cursor moves to the next line, and just stays there. I have to type something and hit enter before anything happens. Then the message "Press any key to continue" appears. After I press enter, the message "Press any key to continue" appears again, along with all the printf's contained in my program, with the scanf's bypassed (even though I never typed in anything). My program is very simple, and runs properly in the regular Windows shell. Does anyone have any idea what I am doing wrong with regards to the Console plugin. Do I have to set it up in some special way to allow for keyboard input?
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Problem with Console Plugin and stdin
by Ygramul on Sat, 17/12/2005 - 20:31
Hi,

the console plugin really does honour STDIN, the real problem lies in the output of your/any program usually being buffered before being printed.
So if you say:
/quote/
I have to type something and hit enter before anything happens
/quote/

this is really your scanf being executed!

To make a long story short: try autoflushing your programs output, so you get to see the question before you have to type the answer.

Hope this helps.
 
Hi, Thanks for answering.
by LordKelvan on Sun, 08/01/2006 - 22:37
Hi,

Thanks for answering. I tried your suggestion and it worked; could you explain to me why this buffering is a problem? It is sort of annoying to have to flush every single time I want to print something out. Are there any plans to make the console behave like the Windows command prompt? Is it hard? Perhaps you could give me some pointers and I could try to improve this very useful plugin Smiling
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293