How can I pass output of a Python script to gets function of a c program ? My c program code is below :
puts("What's your name?");
printf("Hello, %s!\n", name);
$./a.out "$(python -c 'print "A"*1000')"
To send data from the stdout of one command into the stdin of another command, you need a "pipe":
python -c 'print "A"*1000' | ./a.out
I assume that the buffer overrun here is deliberate, so I'll leave out the lecture about the unsafety of
Normally, a command-line utility will acquire its input from the argument array (
argv in the parameters to
main), which usually avoids the need for copying the data and thus any risk if a buffer overrun.