I'm trying to write a program that makes a batch file that you just have to double to compile a program instead of using a big IDE that takes up CPU power or using the command line which gets clunky when you're debugging and you have to run the programming a bajillion times.
here's my code:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//Don't walk in front of me, I may not follow.
//Don't walk behind me, I may not lead.
//Just walk beside me and be my friend.
void main (void) {
FILE *compileThis;
char nameOfCFile[1000];
char commands[1000];
strcpy(commands, "gcc ");
strcat(commands, nameOfCFile);
strcat(commands, ".c \n");
strcat(commands, "pause");
printf("%s", commands);
//find out the name of the file to be compiled
printf("\n\n\nPlease enter the name of your program (not including extension):");
scanf("%s", &nameOfCFile);
compileThis=fopen("compileYourProgram.bat", "w");
fprintf(compileThis, commands);
}
But for whatever reason say when I typed in someCode when it asks me for the name of my program but the batch file doesn't work. When I checked the batch file, it had the following code in it:
and the batch file wouldn't recognize this stuff. What going wrong?