Use _tolower instead of tolower.