Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#include <stdlib.h>
#include <stdio.h>
#include <yaml.h>
static void emit(yaml_emitter_t * emitter, yaml_event_t * event)
if(!yaml_emitter_emit(emitter, event)) {
printf("oh noes\n");
int main(int argc, char *argv[]) {
yaml_event_t event;
yaml_emitter_t emitter;
yaml_emitter_set_output_file(&emitter, stdout);
yaml_stream_start_event_initialize(&event, YAML_UTF8_ENCODING);
emit(&emitter, &event);
yaml_document_start_event_initialize(&event, NULL, NULL, NULL, 0);
emit(&emitter, &event);
yaml_scalar_event_initialize(&event, NULL, NULL, "日本語", 9, 1, 0, 1);
emit(&emitter, &event);
yaml_document_end_event_initialize(&event, 0);
emit(&emitter, &event);
emit(&emitter, &event);
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment