?
Solved

LPCWSTR to __wchar_t

Posted on 2005-05-03
2
Medium Priority
?
500 Views
Last Modified: 2008-03-03
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
Comment
Question by:fsharer
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 13919532
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
 

Author Comment

by:fsharer
ID: 13919902
Thanks, I feel so dumb now, since it was that easy of a solution, I guess that comes with learning
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

862 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