what I want to know is if it is possible to execute a C program and give the inputs to the program through the same .bat file, for example a program that adds 2 numbers, what I do in the code below is to compile it and generate an .exe that is it calls add then in the next line it executes it and when executing it I want that when asking for the numbers the program to add automatically enters 10 then 20 and the program says how much the sum is... it can be done in some way ? Beforehand thank you very much
gcc sumar.c -o sumar
sumar
10
20
pause
If the program expects to receive the values through the standard input, what you can do is redirect said input to a file.
The batch would look like this:
If what you want is to provide the values directly from the batch you have to modify your program so that it reads the input parameters:
batch:
C: