run shell commad in c++
(1) By anonymous on 2021-05-27 20:47:57 [link] [source]
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;
(2) By Larry Brasfield (larrybr) on 2021-05-27 21:25:42 in reply to 1 [source]
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.
(3) By anonymous on 2021-05-27 21:36:54 in reply to 2 [link] [source]
Thanks. Meanwhile, I'd appreciate if you demonstrate an example of one these solutions in a simple c++ function to display a table in box mode.