Вопрос

I'm not a c++ programmer, I need to convert this c++ code to vb.net:

int iRC = 0;            
TCHAR ptcTemp[20];
_itot_s(iRC, ptcTemp, sizeof(ptcTemp), 10);

I don't really understand, all I know is that this is a conversion of an Int to a TCHAR array.

I was wondering if

Dim ptcTemp As String = iRC.ToString()

Would work or maybe I'll miss something?

Any help is apreciated! Thanks :)

Это было полезно?

Решение

_itot_s = integer to t with security

  • i integer
  • to
  • t, type t, this is because C++ can have ASCII or UNICODE, this source code can be compiled as either.
  • s security/safe version, the function has 2 parameters for the buffer, the buffer and its length, so the function can prevent a buffer overload.

The 10 is so the string is a decimal, other popular options are 2 binary, 8 octal, 16 hex.

What you are doing will work OK.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top