I currently have this function to print out every rows of my tables
static int callback(void *NotUsed, int argc, char **argv, char **szColName)
{
for(int i = 0; i < argc; i++)
{
cout.width(17); cout << left << argv[i];
}
std::cout << "\n";
return 0;
}
How do I print out szColName, such that it only appear once on top, and not multiple occurences of it? Tried this:
static int callback(void *NotUsed, int argc, char **argv, char **szColName)
{
int n = sizeof(szColName) / sizeof(szColName[0]);
for (int i = 0; i < n; i++)
{
cout.width(17); cout << left << szColName[i];
}
printf("\n");
for(int i = 0; i < argc; i++)
{
cout.width(17); cout << left << argv[i];
}
std::cout << "\n";
return 0;
}
But it outputs everytime after a outputting the row values