Dynamic wchar_t array (C++ beginner) [closed]

℡╲_俬逩灬. 提交于 2019-12-13 02:16:20

问题


I am modifying some C++ code that has a wchar_t myArray[MAX_PATH] in the header file.

My modifications mean that I cannot know the length of this array until runtime. How can I store an array of dynamic length instead? Maybe I just keep a wchar_t* in the header file and another int to hold its length?


回答1:


Use std::wstring instead. It's a dynamic string containing wchar_t.



来源:https://stackoverflow.com/questions/16360587/dynamic-wchar-t-array-c-beginner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!