No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * text canvas text import/export
  3. * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #include "config.h"
  14. #include "common.h"
  15. #if !defined(__KERNEL__)
  16. # if defined(HAVE_INTTYPES_H)
  17. # include <inttypes.h>
  18. # endif
  19. # include <stdio.h>
  20. # include <string.h>
  21. # include <stdlib.h>
  22. #endif
  23. #include "cucul.h"
  24. #define STRING \
  25. "Hello world!\n" \
  26. " _,----._ \n" \
  27. " (/ @ @ \\) \n" \
  28. " | OO | \n" \
  29. " \\ `--' / \n" \
  30. " `----' \n"
  31. int main(int argc, char *argv[])
  32. {
  33. cucul_canvas_t *cv;
  34. void *buffer;
  35. unsigned long int len;
  36. cv = cucul_create_canvas(0, 0);
  37. cucul_import_memory(cv, STRING, strlen(STRING), "text");
  38. buffer = cucul_export_memory(cv, "utf8", &len);
  39. fwrite(buffer, len, 1, stdout);
  40. free(buffer);
  41. cucul_rotate(cv);
  42. buffer = cucul_export_memory(cv, "utf8", &len);
  43. fwrite(buffer, len, 1, stdout);
  44. free(buffer);
  45. cucul_free_canvas(cv);
  46. return 0;
  47. }