Self-debugging code

-9

0

Your Task

Write a program using ASCII characters. Five alphanumeric (0-9, A-Z, a-z) characters will be inserted at random into your program's source code. Your task is to detect and output these characters inserted into your program.

Conditions

  • Your code cannot use any form of backup file.
  • Your code may produce any unnecessary error messages, provided these are distinguishable from the actual output.
  • The output may be on the screen or into a file.
  • The output may also contain unnecessary characters, but no extra alphanumeric characters (excluding error messages).

Winning

The post with the largest vote count wins.

ghosts_in_the_code

Posted 2015-11-10T09:20:46.190

Reputation: 2 907

Question was closed 2015-11-10T20:56:46.560

7I'm confused about why the folder is relevant. Is this challenge the same as "Write a string so that when any five character are added in arbitrary positions, and the result is run as code, it prints those characters"? – xnor – 2015-11-10T09:31:08.193

2

Hahaha. I hope this post doesn't get investigated for unintentional obscene language. I understand the word http://urbandictionary.com/define.php?term=bugger isn't used much in the USA. It was the line before "conditions" that made me LOL

– Level River St – 2015-11-10T10:05:53.260

@xnor Yes, it is the same. I just wanted to say that the file cannot access a backup of itself. – ghosts_in_the_code – 2015-11-10T11:09:37.480

@steveverrill It was unintentional. I've edited. – ghosts_in_the_code – 2015-11-10T11:09:54.097

@wizzwizz4, are you sure that your edit is not an other question?

– Qwertiy – 2015-12-15T20:28:29.940

@Qwertiy I've rewritten it completely, but I'm pretty sure it's the same question. The same answers would fit it. If you cross reference, you will find the same info (except the stuff about the program that does the code-modification!) – wizzwizz4 – 2015-12-15T21:48:09.880

Answers

15

PHP, 0 bytes

PHP will simply echo the source until it sees an opening code tag <?.

feersum

Posted 2015-11-10T09:20:46.190

Reputation: 29 566

4Why the downvotes? Are you insulted because this is not a Pyth, CJam whatever answer? Feersum has used one of the right languages for the task in question. (+ it is heavily golfed) +1 – Stephan Schinkel – 2015-11-10T09:58:46.413

3I downvoted because this is a popularity contest and while you use a language feature appropriately, I would rather see smart code written by a user than just "hey it works as is with php". – Aaron – 2015-11-10T10:31:56.500

lmoa i like this place ! – Abr001am – 2015-11-10T10:44:13.547

@Aaron ah ok i see sorry. Thought it was code-golf. – Stephan Schinkel – 2015-11-10T13:44:28.743

@StephanSchinkel you don't have to be sorry, popularity-contest are by nature opinion-based and feersum's answer has its merits. They were just not up to my expectations ! – Aaron – 2015-11-10T13:55:19.093

@NoOneIsHere Five alphanumeric (0-9, A-Z, a-z) characters will be inserted... – feersum – 2016-08-29T22:29:03.567