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

Posted on 2005-05-16
Last Modified: 2010-04-24
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 '{'

Question by:fsharer
    LVL 3

    Accepted Solution

    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);

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now