There are So many complex methods for that but i write the most effective and simple one just write this ..
// program name avi.c
#include<stdlib.h>
void main()
{ //// write ur program logic here
getch();
system("type avi.c");
}
by the use of this system function from stdlib.h u can run any dos command from ur c program but please check the output for this only by running the exe of ur program ( in this case avi.exe)
Regards ,
Avinash Chaturvedi( Avi )
Above answer was rated as good by the following members: gunturi.prabhakar
RE: How do you write a program which produces its own ...
Hi,
There are So many complex methods for that but i write the most effective and simple one just write this ..
// program name avi.c
#include<stdlib.h>
void main()
{ //// write ur program logic here
getch();
system("type avi.c");
}
by the use of this system function from stdlib.h u can run any dos command from ur c program but please check the output for this only by running the exe of ur program ( in this case avi.exe)
RE: How do you write a program which produces its own ...
All the solutions above are reading the source code with the files concepts.
find a solution where you do not have a source file to read the contents.
There is a macro or an attiribute which tells the compiler the name of the program, function or the attribute. You can use that to get the source code. try out...!!!