ber_put_null - Linux
Overview
ber_put_null
writes a BER-encoded NULL value to a BER element.
Syntax
ber_put_null(ber_element *ber, int ber_class, int ber_type, const char *ber_opt_identifier)
Options/Flags
- ber_class: BER class for the element.
- ber_type: BER type for the element.
- ber_opt_identifier: Identifier for the element.
Examples
Writing a NULL value to a BER sequence
#include <ber.h>
#include <stdio.h>
int main() {
ber_element *ber = ber_alloc();
ber_printf(ber, "{t}", NULL);
printf("BER-encoded NULL value: %s\n", ber_buffer(ber));
ber_free(ber);
return 0;
}
Writing a NULL value with an identifier.
#include <ber.h>
#include <stdio.h>
int main() {
ber_element *ber = ber_alloc();
ber_printf(ber, "{t:i}", "my_null", NULL);
printf("BER-encoded NULL value with identifier: %s\n", ber_buffer(ber));
ber_free(ber);
return 0;
}
Common Issues
None.
Integration
ber_put_null
can be used with other BER functions to encode complex BER structures.
Related Commands
ber_put_integer
ber_put_string
ber_put_sequence