title: C++ Sqlite select statement and store as vector
body: <p>I would like to select * from abe_account like this</p>
  
  <pre><code>sqlite&gt; select * from abe_account;
  admin|Peter John|admin_account|password
  </code></pre>
  
  <p>But I wanna do that in C++  and return each element e.g</p>
  
  <pre><code>admin as vector x[0]
  Peter John as vector x[1]
  admin_account as vector x[2]
  password as vector x[4]
  </code></pre>
  
  <p>and then use it outside when I close sqlite3_close(db)</p>
  
  <p>such as cout &lt;&lt; x[0] &lt;&lt; endl;</p>
  
  <p>How do i do it, i tried to cout &lt;&lt; str &lt;&lt; endl; </p>
  
  <p>but it print nothing.</p>
  
  <p>the following code below is what I tried on my own:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sqlite3.h&gt;
  
  //g++ -o test test.cpp -lsqlite3
  using namespace std;
  
  int main()
  {
  
      sqlite3 *db;
      sqlite3_stmt * stmt;
  
      if (sqlite3_open("abeserver.db", &amp;db) == SQLITE_OK)
      {
      sqlite3_prepare( db, "SELECT * from abe_account;", -1, &amp;stmt, NULL );//preparing the statement
      sqlite3_step( stmt );//executing the statement
      char * str = (char *) sqlite3_column_text( stmt, 0 );///reading the 1st column of the result
          }
      else
      {
          cout &lt;&lt; "Failed to open db\n";
      }
  
      sqlite3_finalize(stmt);
      sqlite3_close(db);
  
      cout &lt;&lt; str &lt;&lt; endl;
  
      return 0;
  
  }
  </code></pre>