Skip to content

@tenderlove /test.c
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#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");
exit(1);
}
}
int main(int argc, char *argv[]) {
yaml_event_t event;
yaml_emitter_t emitter;
yaml_emitter_initialize(&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);
yaml_stream_end_event_initialize(&event);
emit(&emitter, &event);
yaml_emitter_delete(&emitter);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.