GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  OOPS

 Print  |  
Question:  How do you write a program which produces its own source code as its output?



August 08, 2006 08:06:22 #9
    Member Since: Visitor    Total Comments: N/A 

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)

Regards ,

Avinash Chaturvedi( Avi )

     

 

Back To Question