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

LPCWSTR to __wchar_t

I am trying to pass a string to a LPCWSTR, but I dont know how to do it. I.E.

LPCWSTR sName[];
NetMessageNameEnum(sName, ...)

I want to have sName[] = \\ServerName, but I do not know how to do it.

I tried LPCWSTR sName[] = "\\ServerName"  not avail

can anyone help me  Thanks ahead of time.

I am  using VC++.net in Visual Studio 03
0
fsharer
Asked:
fsharer
1 Solution
 
Jaime OlivaresSoftware ArchitectCommented:
try with
WCHAR sName[] = L"\\ServerName";

or

LPCWSTR sName = L"\\ServerName";

Notice that LPCWSTR defines a **pointer** to a wide-char string, so it makes no sense to use []
0
 
fsharerAuthor Commented:
Thanks, I feel so dumb now, since it was that easy of a solution, I guess that comes with learning
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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