convert string to long long

I'm using VS 2008 to create a C++ DLL (not managed) project and I need convert a char* to a long long type. Is there an easy way to do it?

Thanks in advance :)


Try _atoi64. This takes char* and returns __int64.

The easiest way is to use the std::stringstream (it's also the most typesafe...)

std::stringstream sstr(mystr);
__int64 val;
sstr >> val;

You may need to target a 64-bit application for this to work.


If you're using boost, lexical_cast is the way to go, in my opinion.

long long ll = boost::lexical_cast<long long>(mystr)

Need Your Help

sql query to get null count from a column

sql oracle count

I want to generate a sql query to get null count in a particular column like

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.