Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
12 Views

How to paste C++ code sample

When using the pencil paste button, selecting C++ format, then paste C++ sample code (from copy placed into NotePad) the pasted text (when exiting the paste popup) truncates at if statements containing the less than character.

Apparently the HTML editor thinks this is the start of a tag.

How are we to paste C++ code samples if not with paste C++ format???


Jim
0 Kudos
3 Replies
Highlighted
Moderator
12 Views

Jim,
It maybe a bug in the editor.

If ctrl-v doesn't work, try mouse (right click and select "paste"). See if it works.

I know that ">>" will not show, but other characters seem ok.

Jennifer
0 Kudos
Highlighted
12 Views


Jennifer,

When you (I) click on the pencil, a popup for Paste comes up. Ctrl-V in that window inserts the correct text.

[cpp]const long nCells = 1000000;
long	Array[nCells];

// parallel_for task to find value in array
//
void doFind(long iBegin, long iEnd, long A[], long find, volatile long* foundIndex)
{
 if(*foundIndex < iBegin) return;	// other thread found first occurance
 for(long i=iBegin; i [/cpp]

When you click on Insert, the resultant text is clipped at angle bracket in for statement.

1st for in above contains

for(long i=iBegin; i(lessThanCharacterHere)iEnd; ++i)

What gives??

Jim
0 Kudos
Highlighted
12 Views


Jennifer,

I found a work around.

The left angle bracked must be followed by at least one space (perhaps tab would work too).

Note, you cannot indiscriminately insert space following left angle bracket because

(LeftAngleBracket)(LeftAngleBracket)

is a token in C++

Your Past C++ code needs to be fixed since (LeftAngleBracket)userSymbolName is valid C++ syntax.

Jim Dempsey

0 Kudos