Reputation: 4069
Referring to https://support.microsoft.com/en-us/kb/815657 there in the code they write
String *sURL = S"http://www.microsoft.com";
I assume this defines a pointer and not a normal object compared to
String sURL
Correct? But what is the "S" before the actual string?
Visual Studio tells me that this line of code is wrong, it is saying
an ordinary pointer to a C++/CLI ref class or Interface class is not allowed
What do they mean with that? I use visual Studio 2015.
Upvotes: 1
Views: 403
Reputation: 1074
First thing, this is not plain c++. It is C++/CLI (C++ modified for Common Language Infrastructure) which is a language specification created by Microsoft and intended to supersede Managed Extensions for C++.
So, when you have a pointer in a normal statement like the one mentioned above, you got to change the syntax in CLI
String ^sURL = S"http://www.microsoft.com";
And the S
you used in front of the actual string is present there for typecast
the std::string
to the System::String
Upvotes: 1