#include  <stdio.h>
#include  <inttypes.h>

#define TABLE_NAME "rag_rswdata"

#if 0
~ 174  <1? ?>    (4 bytes, float)
~ 178  <2? ?>    (4 bytes, float)
~ 182  <3? ?>    (4 bytes, float)
~ 186  <4? ?>    (4 bytes, integer)
~ 190  <5? ?>    (4 bytes, integer)
~ 194  <6? ?>    (4 bytes, integer) 
#endif


int main(int argc, char* argv[])
{
	if ( argc > 1 )
	{
		FILE *fp = fopen(argv[1], "rb");
		if ( NULL != fp )
		{
			float  a, b, c;
			int32_t  d, e, f;
			fseek(fp, 174, SEEK_SET);
			fread(&a, sizeof(float), 1, fp);
			fread(&b, sizeof(float), 1, fp);
			fread(&c, sizeof(float), 1, fp);
			fread(&d, sizeof(int32_t), 1, fp);
			fread(&e, sizeof(int32_t), 1, fp);
			fread(&f, sizeof(int32_t), 1, fp);
					
			fclose(fp);
			fp = NULL;
			
			fprintf(stdout,
				"INSERT INTO " TABLE_NAME "(rswname, float_174, float_178, float_182, int_186, int_190, int_194) VALUES ('%s', %.1f, %.1f, %.1f, %d, %d, %d);\n",
				argv[1], a, b, c, d ,e, f);
		}
	}
	
	return 0;
}
