#include <string>
#include <iostream>
using namespace std;
int main() {
 String^ a = L"One two three";
 array<wchar_t>^ s = {L" "};
 array<String^>^ m = a->Split(sk);
 for each (String^ t in m)
   cout<<t<<" ";
 return 0;
}

How to fix this code? I think i need libraries but i don't know wich.

PS: I found this code in book (from line 5 to 9).

Sorry for bad english.

You're mixing together two different things here. Lines 5-8 can only be used in C++/CLI code (C++ with .NET CLR) http://en.wikipedia.org/wiki/C%2B%2B/CLI.

See http://stackoverflow.com/questions/236129/c-how-to-split-a-string for examples of how to do what you are describing. Here's a reference for the istringstream they use in the first example http://www.cplusplus.com/reference/iostream/istringstream/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.