write vector in textbox

Hi guys

I have a int vector[32], i want to write him in a textbox, every value another line. How can i do this? Thanks!

Example: v[0]=1, v[1]=4, v[2]=3;
Textbox: 1
4
3
Convert your vector into a string and then write the string into the textbox.
1
2
3
4
5
6
7
8
9
10
11
12
13
string to_string(const vector<int> &iv, char sep = '\n')
{
  ostringstream oss;

  // only to the 2. last to avoid sep after last elem 
  for (size_t i= 0; i < iv.size()-1; ++i) 
    oss << iv[i] << sep;

  // finally add last elem
  oss << iv[iv.size()-1];

  return oss.str();
}
Topic archived. No new replies allowed.