This topic has been covered numerous times.  It is posted here mostly for newcomers.

If you have more than a few lines of code, use the code link found below the editing window.  It will place a [code] and a [/code] tag pair.  Paste your code between the tags.  It will preserve the indenting and allow certain characters UBB would otherwise forbid.

Don't paste long lines of code between [code] tags.  It will cause the entire thread to go real wide making it difficult to read (sidewards scrolling).  Break and indent them instead.

If the code is between the above mentioned code-tags, it is copy&pasteable (CTRL-C, CTRL-V) to any text editor.
The formatting is preserved.

Don't have a favorite editor?  Well... just click on the search link at the top of this page (look up, way up), put in the word 'editor', search in 'Subject Only', and there you have it.

Edited by Jooel (2005-09-09 01:28 PM)
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.