How to paste code in forums

Hi,

Is there somewhere a short description on how to paste a code in the forums?

I understand that the media has limitations, but I am sure that it is possible to come-up with some guidlines on doing code correctly.

Currently it takes lots of time to format the code if you want to look it properly.

Max

[346 byte] By [MaksimLibenson] at [2007-12-23]
# 1
I’ve had the most luck with pasting from Visual Studio into Word and then copying the new text from Word into the message window on the forum. Granted there is that extra step involved of Word, it does save a huge amount of time in trying to format it more like it was in Visual Studio.
BrendanGrant at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...
# 2
I'm doing the same steps, except that instead of using Microsoft Word, I use Frontpage editor instead. Copy codes from Visual Studio to Frontpage editor, then copy it again and paste it to the text editor of this forum.

Regards,

-chris

ChrisVega at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...
# 3

Thanks, guys

Max

MaksimLibenson at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...
# 4

The other way is to edit your post in HTML mode, and use the PRE tag.

class foo

{

void Format() {}

void ShowCode()

{

this->Format();

}

};

MariusBancila at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...
# 5
Pasting directly from VS works fine so long as I use IE (IETab, specifically). FF loses the formatting. FF is much better at regular posts, though -- I never run into the strange problems where adding a line break makes all my text turn into 3pt font.
RichardBergMSFT at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...
# 6

I ended up writing a small application that replaces the RTF \par code to \line when copy/paste.

Usually I forgot I wrote it and end up fixing the pasted code anyway...

AndreasJohansson at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...
# 7

This mostly works, but there seems to be a bug in how the forums handle code inside PRE tags. I posts some code this way, and later noticed that C++ stype casts (reinterpret_cast, const_casts) had been mangled (the target type between angle brackets didn't show up). I suspect code using templates might have the same problem.

This line

const_cast(var);

was entered inside PRE tags with HTML visable as
const_cast<char *>(var);
but that is not how it appears!

StephenC.Steel at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...
# 8
Andreas Johansson wrote:

I ended up writing a small application that replaces the RTF \par code to \line when copy/paste.

Usually I forgot I wrote it and end up fixing the pasted code anyway...

aimnmhmd at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...
# 9
Maksim Libenson wrote:

Hi,

Is there somewhere a short description on how to paste a code in the forums?

I understand that the media has limitations, but I am sure that it is possible to come-up with some guidlines on doing code correctly.

Currently it takes lots of time to format the code if you want to look it properly.

Max

aimnmhmd at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Suggestions for Forums website...