Pie.c 819 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* This Hello World simply print out "Hello World" */
  2. #include "pal.h"
  3. #include "pal_debug.h"
  4. char str[13];
  5. int main (int argc, char ** argv, char ** envp)
  6. {
  7. pal_printf("start program: %s\n", pal_control.executable);
  8. PAL_HANDLE out = DkStreamOpen("dev:tty", PAL_ACCESS_WRONLY, 0, 0, 0);
  9. if (out == NULL) {
  10. pal_printf("DkStreamOpen failed\n");
  11. return -1;
  12. }
  13. str[0] = 'H';
  14. str[1] = 'e';
  15. str[2] = 'l';
  16. str[3] = 'l';
  17. str[4] = 'o';
  18. str[5] = ' ';
  19. str[6] = 'W';
  20. str[7] = 'o';
  21. str[8] = 'r';
  22. str[9] = 'l';
  23. str[10] = 'd';
  24. str[11] = '\n';
  25. str[12] = 0;
  26. int bytes = DkStreamWrite(out, 0, 12, str, NULL);
  27. if (bytes < 0) {
  28. pal_printf("DkStreamWrite failed\n");
  29. return -1;
  30. }
  31. DkObjectClose(out);
  32. return 0;
  33. }