Calling dos commands from C program

Gudday all
It seems to be a simple task but one that has taxed my obsolete grey matter to the hilt.
I would like call the dos command string dir /b | findstr /c:“.RPT” from a C program and return the value as a variable. This variable is a file name of form *.RPT. I would then like to use this variable to open that file for manipulation. (I am using the dos command as the name of the .RPT file can vary depending upon day and date of creation.)


system("dir /b | findstr /c:\\".RPT\\" ");

 inputFile = fopen("<file name found by system call>", "r"); //fopen("file name","mode i.e r-read");

The above code sends to the screen the .RPT file name e.g. it finds it quite well. See attachment.
I originally used system() as noted above but am aware that there are other alternatives viz. fork(), pipe() etc:

What would be the best alternative to use to get the information back to my C program?

But how do I prevent it from being echoed to the screen and also have it so that I may use it as I wish?