1

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)

3 Answers 3

1

.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)"
Sign up to request clarification or add additional context in comments.

Comments

1

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/

Comments

0

I did some work on C interface with KDB+. It involves printing and creating KDB+ objects using C.

http://code.kx.com/wsvn/code/contrib/aquaqanalytics/InterfacingKDBtoC/?#ab109deb48fbdcebdc610ae05c54e9ede

It might be a bit different in C++ but it should be a starting point for you?

Hope this helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.