  | | | C++ question | C++ question 2004-06-10 - By Helge Mathee
Back cool.
works now....
thanks to all of you.
helge -- -- Original Message -- -- From: Alain Laferrière To: XSI@(protected) Sent: Thursday, June 10, 2004 6:31 PM Subject: RE: C++ question
Example ( myCString is the CString which gets converted to char string ) :
// string buffers char charString[1024]; wchar_t wcharString[1024];
// convert CString to char swprintf( wcharString, L"%s", myCString.GetWideString() ); wcstombs( charString, wcharString, 1024 );
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of François Painchaud Sent: Thursday, June 10, 2004 11:53 PM To: XSI List Subject: Re: C++ question
CString stores wide characters. Use CString method "const wchar_t* GetWideString() const", then use "FILE* _wfopen( const wchar_t* filename, const wchar_t* mode )" or a similar open function. You could also take a look at function "int wctomb( char* mbchar, wchar_t wchar )".
François -- ----- Message d'origine -- ----- Sujet: C++ question Date: Thu, 10 Jun 2004 15:58:11 +0200 De: "Helge Mathee" <helge.mathee@(protected)> A: <XSI@(protected)>
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.0 Transitional//EN"> <HTML><HEAD><TITLE></TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <META content="MSHTML 6.00.2737.800" name=GENERATOR></HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>cool.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>works now....</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>thanks to all of you.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>helge</FONT></DIV> <BLOCKQUOTE dir=ltr style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">-- -- Original Message -- -- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A title=alainl@(protected) href="mailto:alainl@(protected)">Alain Laferrière</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A title=XSI@(protected) href="mailto:XSI@(protected)">XSI@(protected)</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, June 10, 2004 6:31 PM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: C++ question</DIV> <DIV><BR></DIV> <DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2></FONT> </DIV> <DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN class=157212616-10062004>Example ( <SPAN class=157212616-10062004>my</SPAN><SPAN class=157212616-10062004>CString is the CString which gets converted to char string ) :</SPAN></SPAN></FONT></DIV> <DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN class=157212616-10062004></SPAN></FONT><FONT face=Arial color=#000080 size=2><SPAN class=157212616-10062004></SPAN></FONT><FONT face=Arial color=#000080 size=2><SPAN class=157212616-10062004></SPAN></FONT><FONT face=Arial color=#000080 size=2></FONT> </DIV> <DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2> // string buffers <BR> char <SPAN class=157212616-10062004> charString</SPAN>[1024 ];<BR><SPAN class=157212616-10062004> </SPAN>wchar_t <SPAN class=157212616-10062004> wcharString</SPAN>[1024];</FONT></DIV> <DIV><FONT face=Arial color=#000080 size=2></FONT> </DIV> <DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2> // convert CS<SPAN class=157212616-10062004>t</SPAN>ring to char<BR> swprintf( <SPAN class=157212616-10062004>wcharString</SPAN>, L"%s", <SPAN class=157212616-10062004>my</SPAN><SPAN class=157212616-10062004>CString</SPAN>.GetWideString() );<BR> wcstombs( charString, wcharString, 1024 );<BR></FONT></DIV><BR> <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left> <HR tabIndex=-1> <FONT face=Tahoma size=2><B>From:</B> <A href="mailto:owner-xsi@(protected)">owner-xsi@(protected)</A> [mailto:owner-xsi@(protected)] <B>On Behalf Of </B>François Painchaud<BR><B>Sent:</B> Thursday, June 10, 2004 11:53 PM<BR><B>To:</B> XSI List<BR><B>Subject:</B> Re: C++ question<BR></FONT><BR></DIV> <DIV></DIV>CString stores wide characters. Use CString method "const wchar_t* GetWideString() const", then use "FILE* _wfopen( const wchar_t* filename, const wchar_t* mode )" or a similar open function. You could also take a look at function "int wctomb( char* mbchar, wchar_t wchar )".<BR><BR>François<BR> <BR>-- ----- Message d'origine -- ----- <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <TH vAlign=baseline noWrap align=right>Sujet: </TH> <TD>C++ question</TD></TR> <TR> <TH vAlign=baseline noWrap align=right>Date: </TH> <TD>Thu, 10 Jun 2004 15:58:11 +0200</TD></TR> <TR> <TH vAlign=baseline noWrap align=right>De: </TH> <TD>"Helge Mathee" <A class=moz-txt-link-rfc2396E href="mailto:helge.mathee@(protected)"><helge.mathee@(protected)></A>< /TD></TR> <TR> <TH vAlign=baseline noWrap align=right>A: </TH> <TD><A class=moz-txt-link-rfc2396E href="mailto:XSI@(protected)"><XSI@(protected)></A></TD>< /TR></TBODY></TABLE><BR> <META content="MSHTML 6.00.2737.800" name=GENERATOR> <STYLE></STYLE>
<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></BLOCKQUOTE></BODY></HTML>
|
|
 |