stk-code_catmod/data/offset.cxx
grumbel 7a6d165641 - moved trunk/ to trunk/supertuxkart
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1118 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2007-05-27 16:01:53 +00:00

42 lines
750 B
C++

#include <stdio.h>
#include <stdlib.h>
int main ( int argc, char **argv )
{
char *fname = argv[1] ;
FILE *fd = fopen ( fname, "ra" ) ;
if ( fd == NULL )
{
fprintf ( stderr, "Can't open '%s' for reading.\n", fname ) ;
exit ( 1 ) ;
}
for ( int i = 0 ; !feof(fd) ; i++ )
{
char s [ 1024 ] ;
if ( fgets ( s, 1023, fd ) == NULL )
break ;
if ( *s == '#' || *s < ' ' )
continue ;
float x, y ;
if ( sscanf ( s, "%f,%f", &x, &y ) != 2 )
{
fprintf ( stderr, "Syntax error in '%s'\n", fname ) ;
exit ( 1 ) ;
}
x -= 66.68 ;
y = (-y) + 5.39 ;
printf ( "%g,%g\n", x, y ) ;
}
fclose ( fd ) ;
}