use snprintf instead of itoa to support linux system