Pie.c 826 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. pal_printf("start program: %s\n", pal_control.executable);
  7. PAL_HANDLE out = DkStreamOpen("dev:tty", PAL_ACCESS_WRONLY, 0, 0, 0);
  8. if (out == NULL) {
  9. pal_printf("DkStreamOpen failed\n");
  10. return -1;
  11. }
  12. str[0] = 'H';
  13. str[1] = 'e';
  14. str[2] = 'l';
  15. str[3] = 'l';
  16. str[4] = 'o';
  17. str[5] = ' ';
  18. str[6] = 'W';
  19. str[7] = 'o';
  20. str[8] = 'r';
  21. str[9] = 'l';
  22. str[10] = 'd';
  23. str[11] = '\n';
  24. str[12] = 0;
  25. int bytes = DkStreamWrite(out, 0, 12, str, NULL);
  26. if (bytes < 0) {
  27. pal_printf("DkStreamWrite failed\n");
  28. return -1;
  29. }
  30. DkObjectClose(out);
  31. return 0;
  32. }