Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey,
Is it possible to write a C++ console program which prints itself without any file(i.e with .exe only, it prints its own C++ code)?
Posted
Comments
Monster Maker 4-Apr-13 13:19pm    
Without use of any file?

You mean the program should not use file handling??
Sergey Alexandrovich Kryukov 4-Apr-13 15:14pm    
Of course. This is a very popular problem related to computability...
Not too hard to solve, by the way, in any non-trivial (in certain sense) language...
—SA
saad_lah 4-Apr-13 14:30pm    
Yes, a program which doesnot uses a file opening to print itself, but print itself with an .exe only
Sergey Alexandrovich Kryukov 4-Apr-13 15:15pm    
Why didn't you try it by yourself? Good and not very difficult exercise.
—SA
saad_lah 4-Apr-13 15:34pm    
Got an idea, i am trying to make it by myself. :)

1 solution

 
Share this answer
 
Comments
José Amílcar Casimiro 4-Apr-13 13:15pm    
5+
Thomas Daniels 4-Apr-13 13:17pm    
Thank you!
Shmuel Zang 4-Apr-13 13:21pm    
5'ed.
Thomas Daniels 4-Apr-13 13:23pm    
Thank you!
enhzflep 4-Apr-13 13:43pm    
+5 for recalling the off-beat name they have.
I wrote one once that would output the source of a pdf-creation class to a pdf. (had trouble escaping the c++ comments for display in a pdf, fwiw)
For some reason, Quines remind me of sitting in the hairdressers looking into the seemingly endless mirror within a mirror within a mirror etc, etc image that the mirrors opposite one another create.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900