Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
C++ question

C++ question

2004-06-10       - By Alain Laferrière

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  


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)> <mailto:helge.mathee@(protected)>  
A:   <XSI@(protected)> <mailto: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 dir=ltr align=left><FONT face=Arial color=#000080
size=2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2>&nbsp;&nbsp; //
string buffers <BR>&nbsp;&nbsp; char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN
class=157212616-10062004>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;charString</SPAN>[1024];
<BR><SPAN
class=157212616-10062004>&nbsp;&nbsp;&nbsp;</SPAN>wchar_t&nbsp;<SPAN
class=157212616-10062004>&nbsp;&nbsp;&nbsp;
wcharString</SPAN>[1024];</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2>&nbsp;&nbsp; //
convert CS<SPAN class=157212616-10062004>t</SPAN>ring to char<BR>&nbsp;&nbsp;
swprintf(&nbsp;<SPAN class=157212616-10062004>wcharString</SPAN>,
L"%s",&nbsp;<SPAN class=157212616-10062004>my</SPAN><SPAN
class=157212616-10062004>CString</SPAN>.GetWideString() );<BR>&nbsp;&nbsp;
wcstombs(&nbsp;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> owner-xsi@(protected)
 [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>&nbsp;<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)">&lt;helge.mathee@(protected)&gt;</A></TD
></TR>
   <TR>
     <TH vAlign=baseline noWrap align=right>A: </TH>
     <TD><A class=moz-txt-link-rfc2396E
       href="mailto:XSI@(protected)">&lt;XSI@(protected)&gt;</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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
 <DIV><FONT face=Arial size=2>really weird... just doesn't work...</FONT></DIV>
 <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
 <DIV><FONT face=Arial size=2>thanks,</FONT></DIV>
 <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
 <DIV><FONT face=Arial size=2>helge</FONT></DIV></BLOCKQUOTE></BODY></HTML>