Hi i will ask maybe stupid question.
I have a this.


wcx.lpszClassName = classname.c_str();

and i do not understand context classname.c_str(); ???

I know in C just put "windows name".

Recommended Answers

All 4 Replies

classname appears to be std::string object. c_str() returns a null-terminated pointer to the object's string. You should study up on std::string

Where to discover that mystery of my?

#include <string>
#include <iostream>
using namespace std;

int main()
{
    string classname = "windows name";
    char* lpszClassName = classname.c_str();
}

Is the above what you are confused about?

I am confuse why in one tutorial said lpszClassName ="winclass" and in other lpszClassName=classname .c_str(); .
And by the way i never meet some script about std:: ,it means that i never read what std:: means and i never read c_str() ,i have no idea what mystery could be.
I am looking for some good book who can explain that .
And what you write above it is my first time in my life to seen that and it not a miracle .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.