How do I build a ctrl-A delimited string?

Short answer: “\001” sv (“one”; “two”; “three”)

To build delimited strings in general, use the sv (scalar from vector) function:

q)”, ” sv (“Hello”; “world!”)
“Hello, world!”
q)

As in many programming languages, the syntax for non-printable ASCII characters is borrowed from C, although only a subset of C’s sequences is supported:

\n      newline
\r      carriage return
\t      tab

(q also supports a few printable escape sequences: \, ” and ’). However, as in C, you can express any ASCII code in q by following a backslash with the code’s 3 digit octal representation:

q)”\054\040″ sv (“Hello”; “world!”)
“Hello, world!”
q)

Since ctrl-A is ASCII 1, we need to use \001:

q)fstring: “\001” sv (“f1=va”; “f2=vb”; “f3=vc”)
q)fstring
“f1=va\001f2=vb\001f3=vc”
q)

We can use 0: to write fstring to a file, and use an external program to confirm the result:

q)`:test 0: enlist fstring
`:test
q)\\
$ hexdump test
0000000 66 31 3d 76 61 01 66 32 3d 76 62 01 66 33 3d 76
0000010 63 0a
0000012
q)

To break fstring up into its parts, see How do I parse a ctrl-A delimited string?