MFC:: CString & Serialize ::C++
-
Hello. I am very familiar with C++ STL including the containers string and stringstream. When I learned of CString and other MFC data structure and mutator when I began learning MFC from Prosise's book (chapter 6). I am learning MFC so that I can design and implement Windows 32bit programming using C++. Ultimate, as far as textchar data is concerned, is it perferrable to use CString over C++ STL (string, vector, list, etc.)? Is it possible to have view draw character from a string object instead of a CString object? Lastly, does the default implementation for serialize work for C++ STL (string, vecto, list, etc.)? Does the STL container have to transfer data to a CString object first? One last issue involving NULL. Microsoft seems to like using NULL over '0', which Deitel & Deitel recommend (I highly recommend their C++ How to Program). I do not use NULL term at all in my programs. I use '0'. When using core C++ program I have been working on into MFC, is it a necessity to change from '0' to NULL, bool to BOOL, true to TRUE, etc. for *all* code (even non MFC)? Thanks, Kuphryn
-
Hello. I am very familiar with C++ STL including the containers string and stringstream. When I learned of CString and other MFC data structure and mutator when I began learning MFC from Prosise's book (chapter 6). I am learning MFC so that I can design and implement Windows 32bit programming using C++. Ultimate, as far as textchar data is concerned, is it perferrable to use CString over C++ STL (string, vector, list, etc.)? Is it possible to have view draw character from a string object instead of a CString object? Lastly, does the default implementation for serialize work for C++ STL (string, vecto, list, etc.)? Does the STL container have to transfer data to a CString object first? One last issue involving NULL. Microsoft seems to like using NULL over '0', which Deitel & Deitel recommend (I highly recommend their C++ How to Program). I do not use NULL term at all in my programs. I use '0'. When using core C++ program I have been working on into MFC, is it a necessity to change from '0' to NULL, bool to BOOL, true to TRUE, etc. for *all* code (even non MFC)? Thanks, Kuphryn
kuphryn wrote: is it perferrable to use CString over C++ STL (string, vector, list, etc.) That depends on the rest of the application. If the only part of MFC you're using is going to be CString, then its a lot of extra ovehead to carry. kuphryn wrote: Is it possible to have view draw character from a string object instead of a CString object? Yes kuphryn wrote: Does the STL container have to transfer data to a CString object first? No, just the oppsoite. If you're using the stl implementation that ships with VC then there is an overloaded << operator that converts the string to a LPCSTR. If you're like me and using a different STL implementation, then you'll need to write your own or manually cast the CString to a LPCSTR kuphryn wrote: is it a necessity to change from '0' to NULL, bool to BOOL, true to TRUE from 0 to NULL - no, but bool and BOOL are different data types. They both mena the same, but a BOOL is just a typedef for an unsigned char (I think) The opinions expressed in this post are the sole property of the writer and therefore are not guaranteed to contain any accurate statements, nor are they guaranteed to be worth the time you spent reading it.
-
kuphryn wrote: is it perferrable to use CString over C++ STL (string, vector, list, etc.) That depends on the rest of the application. If the only part of MFC you're using is going to be CString, then its a lot of extra ovehead to carry. kuphryn wrote: Is it possible to have view draw character from a string object instead of a CString object? Yes kuphryn wrote: Does the STL container have to transfer data to a CString object first? No, just the oppsoite. If you're using the stl implementation that ships with VC then there is an overloaded << operator that converts the string to a LPCSTR. If you're like me and using a different STL implementation, then you'll need to write your own or manually cast the CString to a LPCSTR kuphryn wrote: is it a necessity to change from '0' to NULL, bool to BOOL, true to TRUE from 0 to NULL - no, but bool and BOOL are different data types. They both mena the same, but a BOOL is just a typedef for an unsigned char (I think) The opinions expressed in this post are the sole property of the writer and therefore are not guaranteed to contain any accurate statements, nor are they guaranteed to be worth the time you spent reading it.
David Fedolfi wrote: They both mena the same, but a BOOL is just a typedef for an unsigned char (I think) A
BOOL
is 4 bytes (in Win32 at least, dunno about Win64), whilebool
is 1 byte. --Mike-- Fetchez la vache! My really out-of-date homepage Sonork - 100.10414 AcidHelm Big fan of Alyson Hannigan and Jamie Salé. -
Hello. I am very familiar with C++ STL including the containers string and stringstream. When I learned of CString and other MFC data structure and mutator when I began learning MFC from Prosise's book (chapter 6). I am learning MFC so that I can design and implement Windows 32bit programming using C++. Ultimate, as far as textchar data is concerned, is it perferrable to use CString over C++ STL (string, vector, list, etc.)? Is it possible to have view draw character from a string object instead of a CString object? Lastly, does the default implementation for serialize work for C++ STL (string, vecto, list, etc.)? Does the STL container have to transfer data to a CString object first? One last issue involving NULL. Microsoft seems to like using NULL over '0', which Deitel & Deitel recommend (I highly recommend their C++ How to Program). I do not use NULL term at all in my programs. I use '0'. When using core C++ program I have been working on into MFC, is it a necessity to change from '0' to NULL, bool to BOOL, true to TRUE, etc. for *all* code (even non MFC)? Thanks, Kuphryn