Boost logo

Boost Users :

From: John Wilkinson (jwilkinson_at_[hidden])
Date: 2004-09-09 14:20:19


Look in Project/<project name> Properties. In the resulting dialog, pick General under Configuration Properties. In the listbox on the right, look at "Character Set", which will tell you whether or not you are using Unicode. I think that Visual Studio defaults to Unicode builds these days, so you should really check this to make sure. A binary dump of the contents of temp2 after the GetWindowText call might be helpful (binary dump so that we can tell if it's Unicode or not). Try this block of code in place of your original:

//m_scanPath is a control variable for the textbox containing the directory.
CString temp2; //Since the stuff in the textbox is a CString.
m_scanPath.GetWindowText(temp2); //Get the directory entered in the textbox.
fs::path scanPath((LPCTSTR) temp2); //This does not work even though the param is a const char *)

Let me know if it compiles, and what happens when you run it.

John

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of RYAN ROSARIO
Sent: Thursday, September 09, 2004 12:36 PM
To: boost-users_at_[hidden]
Subject: RE: [Boost-users] Help with Path Constructor

I am using Visual Studio 2003. I don't think it is a Unicode build, but I am not totally sure.

John Wilkinson <jwilkinson_at_[hidden]> wrote:
Is this a Unicode build? I'm assuming not, since you don't cast the result of GetBuffer, but your code will not work properly with Unicode. In any case, you don't need to use GetBuffer to get a pointer (const TCHAR *) to the buffer; just cast to LPCTSTR (which works for either Unicode or multibyte).

It also might help to know what version of Visual Studio you're using.

John

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of RYAN ROSARIO
Sent: Wednesday, September 08, 2004 11:30 PM
To: boost-users_at_[hidden]
Subject: [Boost-users] Help with Path Constructor

My MFC has a text box that stores the result from a "choose directory" dialog box. I encounter problems when I try to create a path object from the value of this textbox. The debugger shows the value of ! scanPath (what I call my path object) to be "" which is then causing hangs and exceptions...
 
Below is the code I am trying to use. I do not see why the constructor will not recognize the parameter I am passing to it:

//m_scanPath is a control variable for the textbox containing the directory.
CString temp2;    //Since the stuff in the textbox is a CString.
m_scanPath.GetWindowText(temp2);       //Get the directory entered in the textbox.
const char * tempString = temp2.GetBuffer();     //Convert it to a const char *.
fs::path scanPath(tempString);            //This does not work even though the param is a const char *)

What am I doing wrong? I imagine it is some type of type casting problem?
Thanks in Advance,
Ryan

Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net