compilebox
compilebox copied to clipboard
How to enter input stream
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;
}
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.