I have a string that I want to execute in C file and I’d like to get the string from standard input.
echo "Here is some random text.\n" | ./main.c
>Solution :
Read from stdin like any other FILE stream.
#include<stdio.h>
int main()
{
char line[BUFSIZ];
fgets(line, sizeof(line), stdin);
printf("stdin: %s", line);
}