How to convert a string literal to unsigned char array in visual c++

后端 未结 8 1515
闹比i
闹比i 2020-12-06 06:02

How to convert a string to Unsigned char in c++...

I have,

unsigned char m_Test[8];

I want to assign a string \"Hello world\"

8条回答
  •  眼角桃花
    2020-12-06 06:40

    you can use strcpy function But have in mind that m_Test is only 8 size and there will be an overflow. Strcpy won't check that and you will get an exception

    char * strcpy ( char * destination, const char * source );
    

提交回复
热议问题