Preserved Topic: code that shows itself... (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Lebanon |
posted 06-19-2002 08:57
I remember seeing a code snippet that when ran it shows its own source code. |
Paranoid (IV) Mad Scientist From: Omicron Persei 8 |
posted 06-19-2002 10:51 |
Paranoid (IV) Mad Scientist From: Omicron Persei 8 |
posted 06-19-2002 11:23
here is a Jscript version: code: function rep(text) {WScript.Echo(text + '(' + String.fromCharCode(34) + text + String.fromCharCode(34) + ');');}
code: main(a){printf(a,34,a="main(a){printf(a,34,a=%c%s%c,34);}",34;}
code: #include<stdio.h> |
Paranoid (IV) Inmate From: Lebanon |
posted 06-19-2002 14:07
Grumble, Thanks alot! |
Bipolar (III) Inmate From: Victoria, BC |
posted 06-20-2002 19:57
but those scripts only print the code that you tell it, if the code REALLY printed itself, there would be an infinite number of printf("#include.....printf("#include.......printf(..printf(.printf..printf(........... |
Bipolar (III) Inmate From: Victoria, BC |
posted 06-20-2002 20:08
... the C code doesn't work on my Win98 machine ... |
Bipolar (III) Inmate From: Victoria, BC |
posted 06-20-2002 20:15
oh.............................................., i'll shut up now... |
Bipolar (III) Inmate From: the space between us |
posted 06-20-2002 22:16
G-MAN, thatz cool and important |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 06-23-2002 16:16
just thought I would mention it, this kind of program is called a 'quine'. |
Paranoid (IV) Inmate From: Lebanon |
posted 06-24-2002 06:19
tp, nice to know it's called 'quine' ... |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 06-24-2002 17:22
http://c2.com/cgi/wiki?QuinePrograms |