position_stream.c 477 B

12345678910111213141516171819202122232425262728
  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. char* user = argv[1];
  12. char* unit = argv[2];
  13. float x = 0, y = 0, z = 0;
  14. for (;;) {
  15. query_unit_position(user, unit, &x, &y, &z);
  16. printf("%.3f %.3f %.3f\n", x, y, z);
  17. sleep(0.1);
  18. }
  19. return 0;
  20. }