//Prototype
void getChars (std::vector<std::string> *chars);
void getFileNames(std::vector<std::string> *fileList);
int main();
{
std::vector<std::string> characters;
getChars (&characters)
return 0;
}
//getChars
void getChars (std::vector<std::string> *chars)
{
std::vector<std::string> listOfFiles;
//Get the filenames
getFileNames(&listOfFiles);
chars->push.back (listOfFiles[0][1]); //I want to add the second character of the first file in listOfFiles but I get an error
//I can only get it to add the first element but not the second char within the first element.
}
//getFileNames Function
void getFileNames(std::vector<std::string> *fileList)
{
WIN32_FIND_DATA search_data;
memset(&search_data, 0, sizeof(WIN32_FIND_DATA));
HANDLE handle = FindFirstFile("Files\\*.txt", &search_data);
while(handle != INVALID_HANDLE_VALUE)
{
fileList->push_back(std::string(search_data.cFileName));
if(FindNextFile(handle, &search_data) == FALSE)
break;
}
}
See the comment on line 20, any ideas? cannot get the second character of the first element :( , writing the first element works fine though.