[Kstars-devel] branches/kstars/summer/kdeedu/kstars/kstars/data/tools
Akarsh Simha
akarshsimha at gmail.com
Fri Jun 13 21:32:50 CEST 2008
SVN commit 820297 by asimha:
Improvising data/tools/binfiletester.c to print out some more
information about the trixel being read, from the index table entries
CCMAIL: kstars-devel at kde.org
M +4 -0 binfiletester.c
--- branches/kstars/summer/kdeedu/kstars/kstars/data/tools/binfiletester.c #820296:820297
@@ -193,6 +193,7 @@
str[5] = '\0';
id = trixel2number(trixel);
+ printf("Reading star list for trixel %s (%d)\n", trixel, id);
rewind(f);
offset = index_offset + id * 8; // CAUTION: Change if the size of each entry in the index table changes
fseek(f, offset, SEEK_SET);
@@ -203,10 +204,12 @@
}
fread(&offset, 4, 1, f);
fread(&nrecs, 2, 1, f);
+
if(fseek(f, offset, SEEK_SET)) {
fprintf(stderr, "ERROR: Could not seek to position %X in the file. The file is either truncated or the indexes are bogus.\n", offset);
return;
}
+ printf("Data for trixel %s (%d) starts at offset 0x%X and has %d records\n", trixel, id, offset, nrecs);
for(id = 0; id < nrecs; ++id) {
offset = ftell(f);
@@ -261,6 +264,7 @@
else
byteswap = 0;
+ // TODO : Implement byteswapping for nfields, etc
fread(&nfields, 2, 1, f);
for(i = 0; i < nfields; ++i) {
More information about the Kstars-devel
mailing list