954,184 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to convert string to const char* in C

Hello group,
Could anyone of you tell me how to convert string to const char* in C ....function c_str() is not working ...i dont know why............
Thanks...

paramveer
Newbie Poster
8 posts since Jun 2006
Reputation Points: 13
Solved Threads: 0
 

>Could anyone of you tell me how to convert string to const char* in C

const char *p = my_string;

>function c_str() is not working
Are you working with C or C++? Make up your mind. C doesn't have a string type, and C++'s string type is incompatible with C.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You