compilebox icon indicating copy to clipboard operation
compilebox copied to clipboard

How to enter input stream

Open EnziinSystem opened this issue 5 years ago • 1 comments

Hello,

I don't see anyone mentioning the input stream for the program via Terminal simulator web.

If I have the following block code, how will the input stream enter?

#include <stdio.h>
int main() {
 int a;
 int b;

 scanf("%d", &a);
 printf("You entered for a: %d", a);
 scanf("%d", &b);
 printf("You entered for b: %d", b);
 return 0;
}

EnziinSystem avatar Apr 27 '19 08:04 EnziinSystem

The API takes stdin as one of the params here. There is no stream from terminal. The code is sent to server and result is returned. The API allows to send complete input in the same request which will be piped to your code when it runs. scanf and cin will work just fine.

asadm avatar Apr 29 '19 18:04 asadm