  | | | C++ question | C++ question 2004-06-10 - By François Painchaud
Back The context was "Helge Mathee" which is now quite explicit on this list. ;-)
-- ----- Message d'origine -- ----- Sujet: RE: C++ question Date: Thu, 10 Jun 2004 14:02:37 -0400 De: "Luc-Eric Rousseau" <lucer@(protected)> A: <XSI@(protected)>
I think you're confusing the "CString" in MFC with the CString in the XSI SDK. Then again, the context wasn't explicitly specified. -- --Original Message-- -- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)]On Behalf Of Sebastien Dalphond Posted At: Thursday, June 10, 2004 11:13 AM Posted To: xsi Conversation: C++ question Subject: RE: C++ question
You can simply cast the CString to a LPCTSTR
operator LPCTSTR ( ) const;
Then it can be used as a const char*, as in:
CString l_sFilename = "filename.txt";
const char* l_psFileName = (LPCTSTR)l_sFilename;
Sebastien Dalphond
__ ____ ____ _____ Sebastien Dalphond R&D-Hybride
-- --Original Message-- -- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)]On Behalf Of Helge Mathee Sent: Thursday, June 10, 2004 9:58 AM To: XSI@(protected) Subject: C++ question
Maybe I am dumb..... how to convert a CString to a const char *? I need this to read files inside of a c++ operator... really weird... just doesn't work... thanks, helge
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <title></title> </head> <body bgcolor="#ffffff"> The context was "<font face="Tahoma" size="2">Helge Mathee</font>" which is now quite explicit on this list. ;-)<br> <br> -- ----- Message d'origine -- ----- <table cellpadding="0" cellspacing="0" border="0"> <tbody> <tr> <th valign="baseline" align="right" nowrap="nowrap">Sujet: </th> <td>RE: C++ question</td> </tr> <tr> <th valign="baseline" align="right" nowrap="nowrap">Date: </th> <td>Thu, 10 Jun 2004 14:02:37 -0400</td> </tr> <tr> <th valign="baseline" align="right" nowrap="nowrap">De: </th> <td>"Luc-Eric Rousseau" <a class="moz-txt-link-rfc2396E" href="mailto :lucer@(protected)"><lucer@(protected)></a></td> </tr> <tr> <th valign="baseline" align="right" nowrap="nowrap">A: </th> <td><a class="moz-txt-link-rfc2396E" href="mailto:XSI@(protected)">< ;XSI@(protected)></a></td> </tr> </tbody> </table> <br> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <meta content="MSHTML 6.00.2800.1400" name="GENERATOR"> <style></style> <div><span class="035500118-10062004"><font face="Arial" color="#800000" size="2">I think you're confusing the "CString" in MFC</font></span></div> <div><span class="035500118-10062004"><font face="Arial" color="#800000" size="2">with the CString in the XSI SDK.</font></span></div> <div><span class="035500118-10062004"><font face="Arial" color="#800000" size="2">Then again, the context wasn't explicitly specified.</font></span>< /div> <div><span class="035500118-10062004"><font face="Arial" color="#800000" size="2"></font></span> </div> <div class="OutlookMessageHeader" dir="ltr" align="left"><font face="Tahoma" size="2">-- --Original Message-- --<br> <b>From:</b> <a class="moz-txt-link-abbreviated" href="mailto:owner-xsi @(protected)">owner-xsi@(protected)</a> [<a class="moz-txt-link-freetext" href="mailto:owner-xsi@(protected)">mailto:owner-xsi@(protected)</a>]<b>On Behalf Of </b>Sebastien Dalphond<br> <b>Posted At:</b> Thursday, June 10, 2004 11:13 AM<br> <b>Posted To:</b> xsi<br> <b>Conversation:</b> C++ question<br> <b>Subject:</b> RE: C++ question<br> <br> </font></div> <div><span class="299370715-10062004"><font face="Arial" color="#0000ff" size="2">You can simply cast the CString to a LPCTSTR</font> <p><font face="Arial"><font color="#0000ff"><font size="2"><b>operator</b> <b>LPCTSTR</b> <b>(</b> <b>)</b> <b>const;</b></font></font></font></p> <p><span class="299370715-10062004"><font face="Arial" color="#0000ff" size="2">Then it can be used as a const char*, as in:</font></span></p> <p><span class="299370715-10062004"><font face="Arial" color="#0000ff" size="2">CString l_sFilename = "filename.txt";</font></span></p> <p><span class="299370715-10062004"><font face="Arial" color="#0000ff" size="2">const char* l_psFileName = (LPCTSTR)l_sFilename;</font></span></p> <p><span class="299370715-10062004"><font face="Arial" color="#0000ff" size="2">Sebastien Dalphond</font></span></p> <span class="299370715-10062004"> <p><font size="2">__ ____ ____ _____<br> Sebastien Dalphond<br> R&D-Hybride </font></p> </span></span><font face="Tahoma" size="2">-- --Original Message-- --<br> <b>From:</b> <a class="moz-txt-link-abbreviated" href="mailto:owner-xsi @(protected)">owner-xsi@(protected)</a> [<a class="moz-txt-link-freetext" href="mailto:owner-xsi@(protected)">mailto:owner-xsi@(protected)</a>]<b>On Behalf Of </b>Helge Mathee<br> <b>Sent:</b> Thursday, June 10, 2004 9:58 AM<br> <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:XSI@(protected)" >XSI@(protected)</a><br> <b>Subject:</b> C++ question<br> <br> </font></div> <blockquote dir="ltr" style="border-left: 2px solid rgb(0,0,255); padding-left: 5px; margin-left: 5px; margin-right: 0px;"> <div><font face="Arial" size="2">Maybe I am dumb.....</font></div> <div><font face="Arial" size="2"></font> </div> <div><font face="Arial" size="2">how to convert a CString to a const char *?</font></div> <div><font face="Arial" size="2"></font> </div> <div><font face="Arial" size="2">I need this to read files inside of a c++ operator...</font></div> <div><font face="Arial" size="2"></font> </div> <div><font face="Arial" size="2">really weird... just doesn't work...</font>< /div> <div><font face="Arial" size="2"></font> </div> <div><font face="Arial" size="2">thanks,</font></div> <div><font face="Arial" size="2"></font> </div> <div><font face="Arial" size="2">helge</font></div> </blockquote> </body> </html>
|
|
 |