From command line i am getting file name which i have to compile using gcc. lets say its like this.
./a.out fileToBeCompiled.c
Then how i can compile this file using gcc within my program? lets say main.c for which a.out is being made.
From command line i am getting file name which i have to compile using gcc. lets say its like this.
./a.out fileToBeCompiled.c
Then how i can compile this file using gcc within my program? lets say main.c for which a.out is being made.
You can always call gcc to compile from an shell execution command within your program.
Just exec gcc from within you program.
int main(int argc, char** argv)
{
execv("/usr/bin/gcc", argv);
}
./a.out fileToBeCompiled.c && gcc fileToBeCompiled.c
If ./a.out
fails (it it returns something other than 0) gcc will not be called