Function kdb_c_api::null_terminated_str_to_const_S[][src]

pub fn null_terminated_str_to_const_S(string: &str) -> const_S
Expand description

Convert null terminated &str into const_S. Expected usage is to build a q error object with krr.

Example

use kdb_c_api::*;
use kdb_c_api::native::*;
 
pub extern "C" fn must_be_int2(obj: K) -> K{
  unsafe{
    if (*obj).qtype != -qtype::INT{
      krr(null_terminated_str_to_const_S("not an int\0"))
    }
    else{
      KNULL
    }
  }
}
q)check:`libc_api_examples 2: (`must_be_int; 1)
q)a:100
q)check a
'not an int
  [0]  check a
       ^
q)a:42i
q)check a