469,648 Members | 1,154 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

question about System.String, CString, PCSTR, etc, etc

Trying to wrap an unmanaged class.
Here is the function I'm trying to wrap:
bool Init(PCSTR filename, PCSTR username, PCSTR password, PCSTR working);
In my managed C++ class, I have a method like this:
bool CSUSSWrapper::Init(String* filename, String* username, String*
password, String* working)

{

CString _filename(filename);

CString _username(username);

CString _password(password);

CString _working(working);

return m_objSourceSafe.Init((PCSTR)_filename, (PCSTR)_username,
(PCSTR)_password, (PCSTR)_working);

}

Now that seems really ugly and probably not necessary. It compiles and it
works, but it's UGLY. Is there a cleaner way?

THanks,
Steve

Nov 17 '05 #1
1 3633
actually this doesn't work ;(

"SteveK" <as***@asdfasdfsd.com> wrote in message
news:ui**************@TK2MSFTNGP10.phx.gbl...
Trying to wrap an unmanaged class.
Here is the function I'm trying to wrap:
bool Init(PCSTR filename, PCSTR username, PCSTR password, PCSTR working);
In my managed C++ class, I have a method like this:
bool CSUSSWrapper::Init(String* filename, String* username, String*
password, String* working)

{

CString _filename(filename);

CString _username(username);

CString _password(password);

CString _working(working);

return m_objSourceSafe.Init((PCSTR)_filename, (PCSTR)_username,
(PCSTR)_password, (PCSTR)_working);

}

Now that seems really ugly and probably not necessary. It compiles and it
works, but it's UGLY. Is there a cleaner way?

THanks,
Steve

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Herman | last post: by
3 posts views Thread by Terry chan | last post: by
23 posts views Thread by YinTat | last post: by
3 posts views Thread by Morten Overgaard | last post: by
15 posts views Thread by Yifan | last post: by
10 posts views Thread by Herby | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.