Advertisement

A bit of help with CString

Started by March 15, 2003 12:33 PM
2 comments, last by zackriggle 21 years, 8 months ago
Alright, in my app that I have been messing around with to see the alternatives to char*s, I have found a really wierd error. One of which is that it says ''std'' is not a namespace... dunno why that might happen. Also, if in #include <cstring> i still cannot use the CString class. Any ideas as to why this might be?
CString is the MFC string class and has nothing to do with < cstring >, which is a header which supplies functions like strlen that deal with char*.
I guess what you are looking for is the std::string class which you can use when you inlude < string > or < iostream >

My Homepage

[edited by - Burning_Ice on March 15, 2003 1:45:58 PM]
Advertisement
Assuming you are talking about ATL/MFC CString and not std::string, include this in your project:

#include <atlstr.h>

I believe that is all you need for CString. If you want to use std::string, include this in your project:

#include <string>

Include the following line if you do not want to have to type "std::" before "string" everytime you use the class:

using namespace std;

Hope this clears some stuff up

¬_¬

[edited by - Fuzztrek on March 15, 2003 1:46:58 PM]
Ahh... it was all because i was using cstring instead of the atl header...

However... I do not seem to have that header file. If I need to use MFC, tell me how to do so with a DLL file. I have heard very bad things about MFC, so I never learned any of it.

[edited by - zackriggle on March 15, 2003 2:21:35 PM]

This topic is closed to new replies.

Advertisement