跳到主要内容

Console C API

Defnes C API to log/print text messages.

Functions

Name
attribute((eosio_wasm_import) ) const
Prints value as a 64 bit signed integer.

Attributes

Name
uint32_tlen
uint32_tdatalen

Functions Documentation

function attribute

__attribute__(
(eosio_wasm_import)
) const

Prints value as a 64 bit signed integer.

Parameters:

  • cstr - a null terminated string
  • cstr - pointer to string
  • len - len of string to be printed
  • value of 64 bit signed integer to be printed
  • value of 64 bit unsigned integer to be printed
  • value is a pointer to the 128 bit signed integer to be printed
  • value is a pointer to the 128 bit unsigned integer to be printed
  • value of float to be printed
  • value of double to be printed
  • value is a pointer to the long double to be printed
  • name - 64 bit name to be printed
  • data to be printed
  • datalen length of the data to be printed

Prints hexidecimal data of length datalen.

Prints string

Example:

prints("Hello World!"); // Output: Hello World!

Prints string up to given length

Example:

prints_l("Hello World!", 5); // Output: Hello

Prints value as a 64 bit signed integer

Example:

printi(-1e+18); // Output: -1000000000000000000

Prints value as a 64 bit unsigned integer

Example:

printui(1e+18); // Output: 1000000000000000000

Prints value as a 128 bit signed integer

Example:

int128_t large_int(-87654323456);
printi128(&large_int); // Output: -87654323456

Prints value as a 128 bit unsigned integer

Example:

uint128_t large_int(87654323456);
printui128(&large_int); // Output: 87654323456

Prints value as single-precision floating point number

Example:

float value = 5.0 / 10.0;
printsf(value); // Output: 0.5

Prints value as double-precision floating point number

Example:

double value = 5.0 / 10.0;
printdf(value); // Output: 0.5

Prints value as quadruple-precision floating point number

Example:

long double value = 5.0 / 10.0;
printqf(value); // Output: 0.5

Prints a 64 bit names as base32 encoded string

Example:

printn("abcde"_n); // Output: abcde

Prints hexidecimal data of length datalen

Example

unsigned char rawData[9] = {0x49 0x20 0x6C 0x6F 0x76 0x65 0x20 0x62 0x6D};
printhex(&rawData, 9);

Attributes Documentation

variable len

uint32_t len;

variable datalen

uint32_t datalen;

Updated on 2022-12-05 at 15:38:07 +0000