I'm trying to use the PQprint function from libpq (PostgreSQL 14) to print a query on terminal, which requires a PQprintOpt struct instance as an argument.
I've followed what pretty much is the only example I could find (which isn't even on the documentation since PQprint over there has a very basic example):
int main(int argc, char* argv[]) {
[...] // Irrelevant connection procedure
PGresult* res = PQexec(conn, "SELECT * FROM progetto");
checkResults(res, conn); // Just a function for checking results
PQprintOpt options = {0};
options.header = 1;
options.align = 1;
options.fieldSep = "|"; // This gives the warning/error
PQprint(stdout, res, &options);
PQclear(res);
PQfinish(conn);
return 0;
}
I knew something was weird given that it's using " for what should be a char in the struct, but either way it won't work. If it's a string it gives the warning on title, compiling but not printing anything, if I replace the double quotes with single quotes it just errors out on compile: error: invalid conversion from 'char' to 'char*'
I honestly have no idea on what to do at this point.