Integer pointer to char array

I am working on an application (C ++ language on visual studio) where all strings refer to integer pointers.

For example, the class I'm using has this integer pointer to data and a size variable.

{
    ..
    ..
    unsigned short int *pData;
    int iLen
}

I'd like to know

  • Are there any advantages to using a pointer intinstead of a pointer char?

    After thinking a lot, I suspect that the reason may be preventing the application from crashing, which could happen if the char pointer is used without null termination. But I'm not 100% sure.

  • During debugging, how can we check the contents of a pointer where the contents are an array or a char string (in Visual Studio).

    I can only see the address when checking the contents during debugging. Because of this, I have difficulty debugging.

    printf , .

    , , , , char . 100%.

, , .

, , .

{

..

..

unsigned int * pData;

int iLen

}

, , , .

+4
3

, , , . :

  • int array char. ( int ). , char , .

  • , , - , IDE , . , lldb po (char)myIntArray[0] (po ). .

+1

, , EOF - , int.

+1

MS Visual Studio UTF-16 . UTF-16 16- , unsigned short, uint16_t (, , wchar_t, ).

UTF-8; , char ( ) std::string ( ). ; , (, , ).

UTF-16, . , :

object->pData,su

object->pData
+1
source

Source: https://habr.com/ru/post/1655924/


All Articles