|
|
|
String classesSo far in this tutorial, we have seen only simple strings which are not that easy to manipulate. You have to use functions like strcpy, strcat etc to manipulate strings and that is somewhat difficult. The good thing is, you do not want to use those simple strings that much because there are better string types which you can use easily. Most popular string types available are string and CString classes. Where the string class is used most of time is in iostream programming, those programs you write in the first days of your programming life. The string can be used in the same way as other data types such as int, char, etc. Here is an example. #include The other string type which you will find very convenient is CString. When you got familiar with it, you will not even think about using other string types. It is automatically included to your MFC projects. You can include CString to win32 projects too. To do that, follow following steps.
Now, you should be able to compile the project without a problem. If you want to build the application in release mode, then you need to repeat the 3 and 4 steps because there are 2 settings for debug and release modes. In Part 4, you can see the basic operations on CString s. |