Grabbing a char for a vector from another vector

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//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.
Last edited on
Topic archived. No new replies allowed.