• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

How would I convert this line into C++.NET

C#: string[] tokens = clientcommand.Split(new Char[]{'|'});
What I have :String *tokens[] = clCommand->Split(new Char[]{'|'});

this compile error 2 times:
error C2143: syntax error : missing ')' before '{'
this compile error 2 time:
error C2143: syntax error : missing ';' before '{'

0
fsharer
Asked:
fsharer
1 Solution
 
mpf1748Commented:
First off, to define a String array you need:

String *tokens __gc[];

Next, you cannot declare your char array inline. You must decalare it prior to the usage:

__wchar_t cs __gc[] = new __wchar_t __gc[1];
cs[0] = '|';

So, now to put them together, you must have:

//cs initialization.
String *tokens __gc[] = clCommand->Split(cs);
0
 
fsharerAuthor Commented:
Thanks!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now