Reputation: 679
I am trying to create an SSH subsystem. So I configured the file : "/etc/ssh/sshd_config" by adding this line: "Subsystem test /home/test".
And here is the content of the test app:
int main()
{
int i=0;
int j=0;
printf("Hello world!\n");
for (j=0;j<10;j++)
{
scanf ("%d",&i);
printf ("Printed : %d\n",i);
}
return 0;
}
My problem that when I execute this from a remote ssh connexion( ssh -2 -s test user@host ) I can only enter data and I can't see the printed text. (the text will be printed only after the application reach the end)
How can fix that to see the printed text after i enter it not in the end of the application ?
Upvotes: 0
Views: 75
Reputation: 47052
Is this a buffering question? Try calling fflush()
to flush output.
int main()
{
int i=0;
int j=0;
printf("Hello world!\n");
fflush(stdout);
for (j=0;j<10;j++)
{
scanf ("%d",&i);
printf ("Printed : %d\n",i);
fflush(stdout);
}
return 0;
}
Upvotes: 1