geo2js.c 418 B

12345678910111213141516171819202122
  1. #include <stdio.h>
  2. int main() {
  3. float latitude;
  4. float longitude;
  5. char info[80];
  6. int started = 0;
  7. printf("var data=[\n");
  8. while (scanf("%f,%f,%79[^\n]", &latitude , &longitude , info ) == 3) {
  9. if (started)
  10. printf(",\n");
  11. else
  12. started = 1;
  13. printf("{latitude: %f, longitude: %f, info: '%s'}", latitude , longitude , info);
  14. }
  15. printf("\n];\n");
  16. return 0;
  17. }