How do I convert from a std::string to an LPCSTR? A simple cast doesn't work, hopefully there's a way..
How do I convert from a std::string to an LPCSTR? A simple cast doesn't work, hopefully there's a way..
std::string::c_str()
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
LPCSTR is just a typedef for const char*.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Check the following website. It's got a lot of conversion that I find useful
http://www.flounder.com/cstring.htm#...20an%20integer
no offense but that website is pretty terrible. for a start it talks about the mfc CString class, instead of the std::string class.Originally Posted by axr0284
"I saw a sign that said 'Drink Canada Dry', so I started"
-- Brendan Behan
Free Compiler: Visual C++ 2005 Express
If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore.Want to add some scripting to your App?