본문으로 건너뛰기

libraries/eosiolib/capi/eosio/print.h

More...

Functions

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

Attributes

Name
uint32_tlen
uint32_tdatalen

Detailed Description

Copyright: defined in eos/LICENSE

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;

Source code


#pragma once

#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif

__attribute__((eosio_wasm_import))
void prints( const char* cstr );

__attribute__((eosio_wasm_import))
void prints_l( const char* cstr, uint32_t len);

__attribute__((eosio_wasm_import))
void printi( int64_t value );

__attribute__((eosio_wasm_import))
void printui( uint64_t value );

__attribute__((eosio_wasm_import))
void printi128( const int128_t* value );

__attribute__((eosio_wasm_import))
void printui128( const uint128_t* value );

__attribute__((eosio_wasm_import))
void printsf(float value);

__attribute__((eosio_wasm_import))
void printdf(double value);

__attribute__((eosio_wasm_import))
void printqf(const long double* value);

__attribute__((eosio_wasm_import))
void printn( uint64_t name );

__attribute__((eosio_wasm_import))
void printhex( const void* data, uint32_t datalen );

#ifdef __cplusplus
}
#endif

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