run shell commad in c++
when using sqlite3 in shell, to see a table with headers, we can use .mode to try different views of the table in console. Is it possible to execute these commands through a c++ console app we can get the same view as we use sqlite3 in shell? e.g. .mode table select * from tbl1;
You have a few options to accomplish this. One would be to run the SQLite CLI shell in a child process with I/O redirection to drive its input and cause its output to reach your c++ console app's standard output. Another would be to incorporate into your app the same code from shell.c that produces the styles of output you like.