本文整理汇总了C++中DataSource::DataSourceFtell方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSource::DataSourceFtell方法的具体用法?C++ DataSource::DataSourceFtell怎么用?C++ DataSource::DataSourceFtell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSource
的用法示例。
在下文中一共展示了DataSource::DataSourceFtell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GRIB2Inventory
//.........这里部分代码省略.........
/* Used when testing inventory of large TDLPack files. */
/*
#ifdef DEBUG
myAssert (msgNum < 32500L);
if (msgNum % 10 == 0) {
printf ("%ld :: %f\n", msgNum, clock () / (double) CLOCKS_PER_SEC);
}
#endif
*/
/* Make it so the second, third, etc messages have no limit to finding
* the "GRIB" keyword. */
if (msgNum > 1) {
grib_limit = -1;
}
/* Read in the wmo header and sect0. */
if (ReadSECT0 (fp, &buff, &buffLen, grib_limit, sect0, &gribLen,
&version) < 0) {
if (msgNum == 1) {
/* Handle case where we couldn't find 'GRIB' in the message. */
preErrSprintf ("Inside GRIB2Inventory, Message # %d\n", msgNum);
free (buffer);
free (buff);
//fclose (fp);
return -2;
} else {
/* Handle case where there are trailing bytes. */
msg = errSprintf (NULL);
printf ("Warning: Inside GRIB2Inventory, Message # %d\n",
msgNum);
printf ("%s", msg);
free (msg);
/* find out how big the file is. */
fp.DataSourceFseek (0L, SEEK_END);
fileLen = static_cast<int>(fp.DataSourceFtell());
/* fseek (fp, 0L, SEEK_SET); */
printf ("There were %d trailing bytes in the file.\n",
fileLen - offset);
free (buffer);
free (buff);
//fclose (fp);
return msgNum;
}
}
/* Make room for this GRIB message in the inventory list. */
*LenInv = *LenInv + 1;
*Inv = (inventoryType *) realloc ((void *) *Inv,
*LenInv * sizeof (inventoryType));
inv = *Inv + (*LenInv - 1);
/* Start parsing the message. */
inv->GribVersion = version;
inv->msgNum = msgNum;
inv->subgNum = 0;
inv->start = offset;
inv->element = NULL;
inv->comment = NULL;
inv->unitName = NULL;
inv->shortFstLevel = NULL;
inv->longFstLevel = NULL;
if (version == 1) {
if (GRIB1_Inventory (fp, gribLen, inv) != 0) {
preErrSprintf ("Inside GRIB2Inventory \n");
free (buffer);
free (buff);