Is there a way to get string representation of k object, similar (better identical) to that printed to q console?
q)([]a:`a`b`c;b:"abc";c:1 2 3)
a b c
-----
a a 1
b b 2
c c 3
q)
Is there a way to get string representation of k object, similar (better identical) to that printed to q console?
q)([]a:`a`b`c;b:"abc";c:1 2 3)
a b c
-----
a a 1
b b 2
c c 3
q)
There are much better ways to do io with kdb.
With csv you can, for example, store tables:
save `:table.csv
or return tables:
http://host:port/q.csv?table
For more on C/C++ integration, see http://code.kx.com/q/interfaces/using-c-functions/
.Q.s
is used to format something for console printing, can use this to get the q console string.
q)t:([]a:`a`b`c;b:"abc";c:1 2 3)
q)show .Q.s t
"a b c\n-----\na a 1\nb b 2\nc c 3\n"
q)t:([]a:`a`b`c;b:"abc";c:1 2 3)
q)show str:.Q.s t
"a b c\n-----\na a 1\nb b 2\nc c 3\n"
q)-1 str;
a b c
-----
a a 1
b b 2
c c 3
.Q.s1
can be used to get the single line version of the string.
q).Q.s1 t
"+`a`b`c!(`a`b`c;\"abc\";1 2 3)"
I did some work on C interface with KDB+. It involves printing and creating KDB+ objects using C.
It might be a bit different in C++ but it should be a starting point for you?
Hope this helps.