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  >  Interview Questions  >  Programming  >  C++

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



July 07, 2006 13:11:04 #3
 Jayashree   Member Since: Visitor    Total Comments: N/A 

RE: How do you write a program which produces its own ...
 
#include "stdafx.h"#include "string.h"#include "process.h"int main(int argc, char* argv[]){ char cmd[125]; strcpy(cmd, "type "); strcat(cmd, __FILE__); system(cmd); return 0;}
     

 

Back To Question