Search code examples
cwindowsexecution

How to run a .exe file with command prompt?


I am making an online judge. This my school project.

I am taking a .c file from the user. I am able to compile the .c file with command prompt. But I don't know how to run this file. I need to run this file, take input from a text file and save output in a text file. The compilation code was:

    gcc main.c -o HelloWorld

Solution

  • I need to run this file, take input from a text file and save output in a text file.

    Assuming you're on Linux, this should work:

    ./HelloWorld < input.txt > output.txt