WChar_t set to null in C++ -


i have variable in wchararray form. want empty array , reuse it. how can set variable null?

filename[1024] = l'\0';

is way empty array?

you can use std::fill fill array zeros.

std::fill(filename, filename+1024, 0); 

if have c++11 better use std::begin , std::end iterators call.

std::fill(std::begin(filename), std::end(filename), 0); 

to initialize first time can use initializer. default value wchar_t 0 there's no need give values in brackets.

wchar_t filename[1024] = {}; 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -