forked from jlucid/capi
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlists.c
48 lines (41 loc) · 931 Bytes
/
lists.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* File name: lists.c */
#include "common.h"
int main() {
I handle;
I portnumber= 12345;
S hostname= "localhost";
S usernamePassword= "kdb:pass";
K x;
handle= khpu(hostname, portnumber, usernamePassword);
if(!handleOk(handle)) {
m9();
return EXIT_FAILURE;
}
x= k(handle, "reverse `A`B`C", (K) 0);
if(isRemoteErr(x)) {
kclose(handle);
m9();
return EXIT_FAILURE;
}
printf("Symbols: %s %s %s\n", kS(x)[0], kS(x)[1], kS(x)[2]);
r0(x);
x= k(handle, "reverse 1 2 3", (K) 0);
if(isRemoteErr(x)) {
kclose(handle);
m9();
return EXIT_FAILURE;
}
printf("Ints: %lld %lld %lld\n", kJ(x)[0], kJ(x)[1], kJ(x)[2]);
r0(x);
x= k(handle, "reverse 1.0 2.0 3.0", (K) 0);
if(isRemoteErr(x)) {
kclose(handle);
m9();
return EXIT_FAILURE;
}
printf("Floats: %f %f %f\n", kF(x)[0], kF(x)[1], kF(x)[2]);
r0(x);
kclose(handle);
m9();
return EXIT_SUCCESS;
}