loop and compiling inside a code
I've been studying C some weeks for now, and now I'd like to write a little program with it. (I've had quite a lot of experience with QB, Visual Basic and Delphi years ago, but now I picked up C as a course in my univ.)
Anyway I decided to code a little 'game'.
The game is of coding.
Code:
tehtava1()
{
clrscr();
printf("Tehtävä 1: Ohjelmoi 'Hello World' tervehdys, kun olet valmis paina *\n\n");
FILE *tiedosto;
char hw[255];
tiedosto=fopen("c:/temp/helloworld.txt","w");
fflush(stdin);
{
gets(hw);
fprintf(tiedosto,"%s\n",hw);
}
}
the idea is to open the helloworld.txt and allow user to write there. Then it should compile and run the code and compare the result to desired result.
First of all... I just can't make the loop work here... (it should allow user to write lines until user inputs *) also, i've noidea how to compile and run a code inside a code :P
So any ideas? Should I scrap my code and try something else?
(And if someone need information what os/compiler I use, Win XP sp2, Borland Developer Studio 2006)