/****************************************************************************
* CITYDECODER: A SPLAT! File Conversion Utility *
* Copyright John A. Magliacane, KD2BD 2002 *
-* Last update: 13-Apr-2002 *
+* Last update: 08-Feb-2009 *
*****************************************************************************
* *
* This utility reads ASCII Metadata Cartographic Boundary Files available *
int main(argc,argv)
char argc, *argv[];
{
- int x, y, z;
+ int x, y, z, n;
long attributefile_id, coordinatefile_id;
- char string[80], name[80], attributefilename[15], coordinatefilename[15];
+ char string[80], name[80], attributefilename[15], coordinatefilename[15], *s=NULL;
double lat, lon;
FILE *attributefile=NULL, *coordinatefile=NULL;
/* Skip First ASCII File Record (ID=0) */
for (x=0; x<7; x++)
- fgets(string,80,attributefile);
+ s=fgets(string,80,attributefile);
do
{
string[0]=0;
- fscanf(coordinatefile,"%ld", &coordinatefile_id);
+ n=fscanf(coordinatefile,"%ld", &coordinatefile_id);
if (coordinatefile_id!=-99999)
{
name[0]=0;
- fscanf(coordinatefile,"%lf %lf",&lon, &lat);
+ n=fscanf(coordinatefile,"%lf %lf",&lon, &lat);
/* Read ID Number From Attribute File */
- fgets(string,80,attributefile);
- sscanf(string,"%ld",&attributefile_id);
+ s=fgets(string,80,attributefile);
+ n=sscanf(string,"%ld",&attributefile_id);
/* Skip Two Strings in Attribute File */
- fgets(string,80,attributefile);
- fgets(string,80,attributefile);
+ s=fgets(string,80,attributefile);
+ s=fgets(string,80,attributefile);
/* Read City Name From Attribute File */
- fgets(string,80,attributefile);
+ s=fgets(string,80,attributefile);
/* Strip "quote" characters from name */
/* Skip Two Strings in Attribute File */
- fgets(string,80,attributefile);
- fgets(string,80,attributefile);
+ s=fgets(string,80,attributefile);
+ s=fgets(string,80,attributefile);
/* Skip blank line between records */
- fgets(string,80,attributefile);
+ s=fgets(string,80,attributefile);
if (name[0]!=0 && name[0]!=' ' && feof(attributefile)==0 && attributefile_id==coordinatefile_id)
printf("%s, %f, %f\n",name,lat,-lon);
do
{
string[0]=0;
- fscanf(coordinatefile,"%s",string);
+ n=fscanf(coordinatefile,"%s",string);
} while (strncmp(string,"END",3)!=0 && feof(coordinatefile)==0);