I tried using a reference instead of a static var for my files vector like so -but when I use it, I have a bunch of valid file names after the ListFiles call, but a few lines later, all the values are junk such as "iiiiiiiiiiiiiiiiiiiiiii", what could cause it?Code:bool ListFiles(TCHAR* path, std::vector<TCHAR *> &files) {
Code:if (ListFiles(dir, files)) { for (std::vector<TCHAR *>::iterator it = files.begin(); it != files.end(); ++it) { TCHAR* text = new TCHAR[_MAX_PATH]; GetWindowText(textArea, text, _MAX_PATH); StringCchCat(text, MAX_PATH, *it); SetWindowText(textArea,text); } }




Reply With Quote