Am 11.06.2012 01:58, schrieb qunuxy-osmmailingli...@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;
}
_______________________________________________
Talk-de mailing list
Talk-de@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-de