Is there any method?
My computer is AMD64.
BOOL loadU(const wchar_t* lpszPathName, int flag = 0);
When I used:
the VS2005 compiler says:
Error 7 error C2664:: cannot convert parameter 1 from 'std::string *__w64 ...
How to remove first and last character from std::string, I am already doing the following code.
But this code only removes the last character
m_VirtualHostName = m_VirtualHostName.erase(m_VirtualHostName.size() - 1)
How to remove the first character a...
How to parse a string to an int in C++?
How do you convert a C++ string to an int?
Assume you are expecting the string to have actual numbers in it ("1", "345", "38944", for example).
Also, let's assume you don't have boos...
When should I use std::string and when should I use char* to manage arrays of chars in C++?
It seems you should use char* if performance(speed) is crucial and you're willing to accept some of a risky business because of the memory management.
Are there ...
Problem: I have an integer; this integer needs to be converted to a stl::string type.
In the past, I've used stringstream to do a conversion, and that's just kind of cumbersome. I know the C way is to do a sprintf, but I'd much rather do a C++ method th...
CString is quite handy, while std::string is more compatible with STL container.
I am using hash_map. However, hash_map does not support CString as key, so I want to convert CString into std::string.
Writing a CString hash function seems to take a lot of...
I was wondering if there was an alternative to itoa() for converting an integer to a string because when I run it in visual Studio I get warnings, and when I try to build my program under Linux, I get a compilation error.
I'm currently using the following code to right-trim all the std::strings in my programs:
It works fine, but I wonder if there are some end-cases where it might fail?
Of course, answers with ele...
int i = 4;
string text = "Player ";
cout << (text + i);
I'd like it to print Player 4.
The above is obviously wrong but it shows what I'm trying to do here. Is there an easy way to do this or do I have to start adding new includes?
I need to store strings in key value format. So am using Map like below.
using namespace std;
map<string, string> m;
string s1 = "1";
string v1 = "A";
m.insert(pair<string, string>(s1, v1)); /...
I'm looking for the most elegant way to implode a vector of strings into a string. Below is the solution I'm using now:
static std::string& implode(const std::vector<std::string>& elems, char delim, std::string& s)
I've seen several other posts about converting QString to std::string, and it should be simple. But somehow I'm getting an error.
My code is compiled into a VS project using cmake (I'm using VS express), so there's no issue with the QT libraries, and the...
At the top of my file I have
#define AGE "42"
Later in the file I use ID multiple times including some lines that look like
1 std::string name = "Obama";
2 std::string str = "Hello " + name + " you are " + AGE + " years old!";
3 str += "Do you feel " ...
I know it is a common issue, but looking for references and other material I don't find a clear answer to this question.
Consider the following code:
// in a method
std::string a = "Hello ";
std::string b = "World";