[Talk-de] unbekanntes Datenformat aus GPS-Logger

bkmap burkhard.kirchner at web.de
Mo Jun 11 00:46:30 UTC 2012


Am 11.06.2012 01:58, schrieb qunuxy-osmmailinglists at yahoo.com:
>> Dieser Variante hier ist die Größe des Offsets egal.
>
> Meinst du damit z.B. 57 + 1024 oder 57 - 1024?
>
> Mit dieser Version sollte das ebenfalls funktionieren:
>

ok, die Version war bei mir noch nicht angekommen. Da hätte ich mir das 
Posten sparen können :-)

Burkhard

> #include<stdlib.h>
> #include<stdio.h>
>
> int main (int argc, char *argv[])
> {
>      if (argc != 2)
>      {
>          printf("usage: %s filename\n", argv[0]);
>          exit(1);
>      }
>      else
>      {
>          FILE *file = fopen(argv[1],"r");
>
>          if (file == NULL)
>          {
>              printf("Could not open file\n");
>              exit(1);
>          }
>          else
>          {
>              int start = 0;
>              int detect = 0;
>              int c = 0;
>              long int pos = 0;
>              int offset = 0;
>
>              while ((c = fgetc(file)) != EOF)
>              {
>                  if (c == '\n')
>                  {
>                      if(start)
>                      {
>                          printf("\n");
>                      }
>                      else
>                      {
>                          start = 1;
>                      }
>                  }
>                  else
>                  {
>                      if(start)
>                      {
>                          if(detect)
>                          {
>                              c+=offset;
>                              printf("%c",c);
>                          }
>                          else
>                          {
>                              pos = ftell(file);
>
>                              while ((c = fgetc(file)) != EOF)
>                              {
>                                  if (c == '\n')
>                                  {
>                                      fseek(file,-4,SEEK_CUR);
>                                      offset = '*' - fgetc(file);
>                                      detect = 1;
>                                      break;
>                                  }
>                              }
>
>                              fseek(file,pos-1,SEEK_SET);
>                          }
>                      }
>                  }
>              }
>
>              fclose(file);
>          }
>      }
>
>      return 0;
> }






Mehr Informationen über die Mailingliste Talk-de