position_stream.c 562 B

1234567891011121314151617181920212223242526272829
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include "help/query.h"
  4. // When trying to open for read while writing
  5. // then program crashes
  6. // TODO: fix it pls
  7. int main(int argc, char* argv[]) {
  8. if (argc < 3) {
  9. return 1;
  10. }
  11. unsigned user_id = (unsigned)atoi(argv[1]);
  12. unsigned unit_id = (unsigned)atoi(argv[1]);
  13. char* root = getenv("RELAT_ROOT");
  14. double x = 0, y = 0, z = 0;
  15. for (;;) {
  16. get_unit_position(root, unit_id, &x, &y, &z);
  17. printf("%.3f %.3f %.3f\n", x, y, z);
  18. sleep(0.1);
  19. }
  20. return 0;
  21. }