Skip to main content

S_to_str

Function S_to_str 

Source
pub fn S_to_str<'a>(cstring: S) -> &'a str
Expand description

Convert S to &str. This function is intended to convert symbol type (null-terminated char-array) to str.

ยงExtern

use kdbplus::*;
use kdbplus::api::*;

#[no_mangle]
pub extern "C" fn print_symbol(symbol: K) -> K{
  unsafe{
    if (*symbol).qtype == qtype::SYMBOL_ATOM{
      println!("symbol: `{}", S_to_str((*symbol).value.symbol));
    }
    // return null
    KNULL
  }
}
q)print_symbol:`libapi_examples 2: (`print_symbol; 1)
q)a:`kx
q)print_symbol a
symbol: `kx