I am writing a code in which I need to parse a string to a “long long int”
I used to use atoi when changing from string to int, I dont think it still work. What Can I use now?
–Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
strtoll()(man page):(This is only available in C99 and C11, not in C89.) The third argument is the number base for the conversion, and
0means “automatic”, i.e. decimal, octal or hexadecimal are selected depending on the usual conventions (10,010,0x10). Just be mindful of that in case your string starts with0.