Thiago R. Adams website

Home Code-Blog Projects Twitter Blog Links / Books About

Websites

Function to parse integers. It doesn't handle plus and minus sign.


int ParsePositiveInt(const wchar_t* psz)
{
  int result = 0; 
  while ((*psz >= '0') && (*psz <= '9'))
  { 
    result = result * 10 + (*psz - '0'); 
    psz++; 
  } 
  return result;
}

Want to see more? Go to the CodeBlog section.

About the author: I am Thiago Adams. I work as a professional C++ software engineer. I have created this website to share ideas and source code with other people with similar interests.
I would like to hear from you comments, critics, questions and suggestions about this topic or any other part of this website. Email: thiago.adams at gmail dot com