本文整理汇总了C++中CMmsgPrint函数的典型用法代码示例。如果您正苦于以下问题:C++ CMmsgPrint函数的具体用法?C++ CMmsgPrint怎么用?C++ CMmsgPrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CMmsgPrint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CMmsgPrint
const char *NFtimePrint(NFtime_p timePtr, char *timeStr) {
if (timeStr == (char *) NULL) {
CMmsgPrint(CMmsgAppError, "Invalid time string pointer in %s:%d!\n", __FILE__, __LINE__);
}
else if (timePtr->Minute != NFtimeUnset)
sprintf (timeStr, "%04d-%02d-%02d %02d %02d", timePtr->Year, timePtr->Month, timePtr->Day, timePtr->Hour,
timePtr->Minute);
else if (timePtr->Hour != NFtimeUnset)
sprintf (timeStr, "%04d-%02d-%02d %02d", timePtr->Year, timePtr->Month, timePtr->Day, timePtr->Hour);
else if (timePtr->Day != NFtimeUnset)
sprintf (timeStr, "%04d-%02d-%02d", timePtr->Year, timePtr->Month, timePtr->Day);
else if (timePtr->Month != NFtimeUnset) sprintf (timeStr, "%04d-%02d", timePtr->Year, timePtr->Month);
else
sprintf (timeStr, "%04d", timePtr->Year);
return (timeStr);
}
开发者ID:bmfekete,项目名称:nFrames,代码行数:16,代码来源:NFtime.c
示例2: _NCdsHandleGContTestNodata
static bool _NCdsHandleGContTestNodata(const NCdsHandleGCont_t *gCont, double val) {
switch (gCont->GType) {
default:
CMmsgPrint(CMmsgAppError, "Invalid data NetCDF type in: %s %d", __FILE__, __LINE__);
break;
case NC_BYTE:
case NC_SHORT:
case NC_INT:
return ((gCont->MissingVal.Int == (int) val) || (gCont->FillValue.Int == (int) val) ? true : false);
case NC_FLOAT:
case NC_DOUBLE:
return (NCmathEqualValues(gCont->MissingVal.Float, val) || NCmathEqualValues(gCont->FillValue.Float, val)
? true : false);
}
return (true);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:16,代码来源:NCdsHandleGCont.c
示例3: _MDCParamAlbedo
static void _MDCParamAlbedo (int itemID) {
// Input
int cover;
float snowPack;
// Local
static float albedo [] = { 0.14, 0.18, 0.18, 0.20, 0.20, 0.22, 0.26, 0.10 };
static float albedoSnow [] = { 0.14, 0.23, 0.35, 0.50, 0.50, 0.50, 0.50, 0.50 };
cover = MFVarGetInt (_MDInCoverID, itemID, 7); // defaulting missing value to water.
if ((cover < 0) || (cover >= (int) (sizeof (albedo) / sizeof (albedo [0])))) {
CMmsgPrint (CMmsgWarning,"Warning: Invalid cover [%d] in: %s:%d\n",cover,__FILE__,__LINE__);
return;
}
snowPack = MFVarGetFloat (_MDInSnowPackID, itemID, 0.0);
MFVarSetFloat (_MDOutCParamAlbedoID,itemID,snowPack > 0.0 ? albedoSnow[cover] : albedo[cover]);
}
开发者ID:ArielMiara,项目名称:WBMplus,代码行数:16,代码来源:MDCParams.c
示例4: _NCgridVariableCreate
static NCgridVariable_p _NCgridVariableCreate(size_t fileNum) {
size_t i;
NCgridVariable_p gridVariable;
if (((gridVariable = (NCgridVariable_p) calloc(1, sizeof(NCgridVariable_t))) == (NCgridVariable_p) NULL) ||
((gridVariable->VarIDs = (int *) calloc(fileNum, sizeof(int))) == (int *) NULL) ||
((gridVariable->Units = (ut_unit **) calloc(fileNum, sizeof(ut_unit *))) == (ut_unit **) NULL)) {
CMmsgPrint(CMmsgSysError, "Memory alloction error in %s:%s!\n", __FILE__, __LINE__);
return ((NCgridVariable_p) NULL);
}
for (i = 0; i < fileNum; ++i) {
gridVariable->VarIDs[i] = CMfailed;
gridVariable->Units[i] = (ut_unit *) NULL;
}
return (gridVariable);
}
开发者ID:bmfekete,项目名称:nFrames,代码行数:16,代码来源:NCgrid.c
示例5: NCdataGetType
NCdataType NCdataGetType(int ncid) {
int status;
char dTypeStr[NC_MAX_NAME];
if ((status = nc_get_att_text(ncid, NC_GLOBAL, NCnameGADataType, dTypeStr)) == NC_NOERR) {
if (strncmp(dTypeStr, NCnameTypeGCont, strlen(NCnameTypeGCont)) == 0) return (NCtypeGCont);
else if (strncmp(dTypeStr, NCnameTypeGDisc, strlen(NCnameTypeGDisc)) == 0) return (NCtypeGDisc);
else if (strncmp(dTypeStr, NCnameTypePoint, strlen(NCnameTypePoint)) == 0) return (NCtypePoint);
else if (strncmp(dTypeStr, NCnameTypeLine, strlen(NCnameTypeLine)) == 0) return (NCtypeLine);
else if (strncmp(dTypeStr, NCnameTypePolygon, strlen(NCnameTypePolygon)) == 0) return (NCtypePolygon);
else if (strncmp(dTypeStr, NCnameTypeNetwork, strlen(NCnameTypeNetwork)) == 0) return (NCtypeNetwork);
CMmsgPrint(CMmsgAppError, "Invalid data type in: %s %d", __FILE__, __LINE__);
return (NCtypeUndefined);
}
return (NCtypeGCont);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:16,代码来源:NCdata.c
示例6: RGlibGenFuncFieldCompare
DBInt RGlibGenFuncFieldCompare (DBObjTable *table,char *f0Text,char *f1Text,char *rText,DBInt diffMethod)
{
DBInt intVal, ret, i, rowID;
DBFloat val [2];
DBObjTableField *field [2];
DBObjTableField *result;
DBObjRecord *record;
field [0] = table->Field (f0Text);
field [1] = table->Field (f1Text);
result = table->Field (rText);
if ((field [0] == (DBObjTableField *) NULL) || (field [1] == (DBObjTableField *) NULL))
{ CMmsgPrint (CMmsgAppError, "Invalid Compare Fields in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (result == (DBObjTableField *) NULL)
table->AddField (result = new DBObjTableField (rText,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4)));
if (diffMethod > 0) result->Format ("%6.2f");
for (rowID = 0;rowID < table->ItemNum ();++rowID)
{
record = table->Item (rowID);
if ((record->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle)
result->Float (record,result->FloatNoData ());
else
{
for (i = 0;i < 2;++i)
if (field [i]->Type () == DBTableFieldInt)
{
intVal = field [i]->Int (record);
ret = intVal == field [i]->IntNoData ();
val [i] = (DBFloat) intVal;
}
else
{
val [i] = field [i]->Float (record);
ret = CMmathEqualValues (val [i],field [i]->FloatNoData ());
}
if (ret) result->Float (record,result->FloatNoData ());
else switch (diffMethod)
{
default: result->Float (record, val [0] - val [1]); break;
case 1: result->Float (record,(val [0] - val [1]) * 100.0 / val [0]); break;
case 2: result->Float (record,(val [0] - val [1]) * 100.0 / (val [0] > val [1] ? val [0] : val [1])); break;
}
}
}
return (DBSuccess);
}
开发者ID:bandi13,项目名称:RGIS,代码行数:47,代码来源:RGlibGenFuncs.C
示例7: Finalize_Hamon
void Finalize_Hamon(void *userData) {
size_t i;
HamonData_t *data = (HamonData_t *) userData;
CMmsgPrint(CMmsgUsrError, "Parameter0: %lf\n", data->Parameter0);
CMmsgPrint(CMmsgUsrError, "Parameter1: %lf\n", data->Parameter1);
CMmsgPrint(CMmsgUsrError, "Airtemp: %lf\n", data->Airtemp);
CMmsgPrint(CMmsgUsrError, "VaporPressure: %lf\n", data->VaporPressure);
CMmsgPrint(CMmsgUsrError, "PotEvap: %lf\n", data->PotEvap);
for (i = 0; i < VectorLen; ++i) CMmsgPrint(CMmsgInfo, "Vector: %lf\n", data->Vector[i]);
}
开发者ID:bmfekete,项目名称:nFrames,代码行数:11,代码来源:PETlib.c
示例8: NCdsHandleDefine
NCstate NCdsHandleDefine (NCdsHandle_t *dsh, int *ncids, size_t n)
{
NCdataType dataType;
int i;
dsh->NCIds = (int *) NULL;
NCdsHandleClear (dsh);
if (n < 1) return (NCfailed);
if ((dataType = NCdataGetType (ncids [0])) == NCtypeUndefined) return (NCfailed);
dsh->DataType = dataType;
if ((dsh->NCIds = (int *) calloc (n,sizeof (int))) == (int *) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory allocation error in: %s %d",__FILE__,__LINE__); return (NCfailed); }
for (i = 0;i < n;++i) dsh->NCIds [i] = ncids [i];
dsh->NCnum = n;
return (NCsucceeded);
}
开发者ID:bandi13,项目名称:RGIS,代码行数:17,代码来源:NCdsHandle.c
示例9: main
int main( int argc, char* argv[] )
{
fData* theData;
int errCheck;
setInputFiles( argc,argv );
theData = readFile( dataFile, dataTypesFile, &errCheck );
if(errCheck)
CMmsgPrint (CMmsgUsrError, "errors were reported, but continuing anyways.");
printDataTypes( *theData );
freeFData( theData );
return 0;
}
开发者ID:amiara,项目名称:RGIS,代码行数:17,代码来源:FPrintDataTypes.c
示例10: NFcontextCreate
NFcontext_p NFcontextCreate () {
NFcontext_p context;
if ((context = (NFcontext_p ) malloc (sizeof (NFcontext_t))) == (NFcontext_p) NULL) {
CMmsgPrint (CMmsgSysError,"Memory allocation error in %s:%d\n",__FILE__,__LINE__);
return ((NFcontext_p) NULL);
}
context->TimeStepUnit = (const char *) NULL;
context->MinTimeStep = 0;
context->MaxTimeStep = 0;
context->ParameterNum = context->VariableNum = 0;
context->Parameters = (struct NFparameter_s *) NULL;
context->Variables = (struct NFvariable_s *) NULL;
context->UserDataSize = 0;
context->UserData = (void *) NULL;
return (context);
}
开发者ID:ztessler,项目名称:nFrames,代码行数:17,代码来源:NFcontext.c
示例11: DBExportNetCDF
int DBObjData::Write (const char *fileName)
{
DBInt ret;
FILE *file;
if (strncmp(CMfileExtension(fileName),"nc",2) == 0)
ret = DBExportNetCDF (this,fileName);
else
{
if ((file = fopen (fileName,"w")) == (FILE *) NULL)
{ CMmsgPrint (CMmsgSysError, "File (%s) Opening Error in: %s %d", fileName, __FILE__,__LINE__); return (DBFault); }
ret = Write (file);
fclose (file);
}
return (ret);
}
开发者ID:gyelnats,项目名称:RGIS,代码行数:17,代码来源:DBObjReadWrit.C
示例12: MDBgcRiverGPPDef
int MDBgcRiverGPPDef () {
int optID = MFUnset;
const char *optStr;
const char *options [] = { "none", "calculate", (char *) NULL };
if (_MDRiverGPPID != MFUnset) return (_MDRiverGPPID);
MFDefEntering ("Calculate river GPP");
if (((optStr = MFOptionGet (MDOptReservoirs)) == (char *) NULL) || ((optID = CMoptLookup ( options, optStr, true)) == CMfailed)) {
CMmsgPrint(CMmsgUsrError,"Reservoir Option not specified! Option none or calculate \n");
return CMfailed;
}
if (optID==1){
// printf ("Resoption=%i\n",optID);
if (((_MDInResStorageID = MFVarGetID (MDVarReservoirStorage, "km3", MFInput, MFState, MFInitial)) == CMfailed) ||
((_MDInResStorageChangeID = MFVarGetID (MDVarReservoirStorageChange, "km3/s", MFInput, MFState, MFBoundary)) == CMfailed))
return CMfailed;
}
//input
if (//((_MDInDischargeID = MDDischargeDef ()) == CMfailed) ||
((_MDInRiverLightID = MDBgcRiverLightDef ()) == CMfailed) ||
((_MDInDischargeID = MFVarGetID (MDVarDischarge, "m3/s", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverWidthID = MFVarGetID (MDVarRiverWidth, "m", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInPAR2BottomID = MFVarGetID (MDVarPAR2Bottom, "MJ/m2/d", MFInput, MFState, MFBoundary)) == CMfailed) ||
// output
((_MDBenthicAlgaeCHLID = MFVarGetID (MDVarBenthicAlgaeCHL, "g/m2", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDBenthicAlgaeCID = MFVarGetID (MDVarBenthicAlgaeC, "g/m2", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDBenthicGPPID = MFVarGetID (MDVarBenthicGPP, "g/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDBenthicRaID = MFVarGetID (MDVarBenthicRa, "g/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDBenthicNPPID = MFVarGetID (MDVarBenthicNPP, "g/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDBenthicMortalityID = MFVarGetID (MDVarBenthicMortality, "g/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDBenthicAlgaeC_REACHID = MFVarGetID (MDVarBenthicAlgaeC_REACH, "g/m2", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDBenthicGPP_REACHID = MFVarGetID (MDVarBenthicGPP_REACH, "g/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDBenthicRa_REACHID = MFVarGetID (MDVarBenthicRa_REACH, "g/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDBenthicNPP_REACHID = MFVarGetID (MDVarBenthicNPP_REACH, "g/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDBenthicMortality_REACHID = MFVarGetID (MDVarBenthicMortality_REACH, "g/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDRiverGPP) == CMfailed)) return (CMfailed);
MFDefLeaving ("Calculate river GPP");
return (_MDRiverGPPID);
}
开发者ID:wk1984,项目名称:wbmsed,代码行数:45,代码来源:MDBgcRiverGPP.c
示例13: NCdsHandleGContSetFill
NCstate NCdsHandleGContSetFill(NCdsHandleGCont_t *gCont, size_t row, size_t col) {
if (row > gCont->RowNum) return (NCfailed);
if (col > gCont->ColNum) return (NCfailed);
switch (gCont->GType) {
default:
CMmsgPrint(CMmsgAppError, "Invalide NetCDF type in: %s %d", __FILE__, __LINE__);
return (NCfailed);
case NC_BYTE:
case NC_SHORT:
case NC_INT:
gCont->Data[gCont->ColNum * row + col] = (double) gCont->FillValue.Int;
break;
case NC_FLOAT:
case NC_DOUBLE:
gCont->Data[gCont->ColNum * row + col] = gCont->FillValue.Float;
break;
}
return (NCsucceeded);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:19,代码来源:NCdsHandleGCont.c
示例14: CMmsgPrint
char *NCdataGetTextAttribute(int ncid, int varid, const char *attName) {
int status;
char *att;
size_t attlen;
if ((status = nc_inq_attlen(ncid, varid, attName, &attlen)) != NC_NOERR) return ("undefined");
if ((att = (char *) malloc(attlen + 1)) == (char *) NULL) {
CMmsgPrint(CMmsgSysError, "Memory allocation error in: %s %d", __FILE__, __LINE__);
return ((char *) NULL);
}
if ((status = nc_get_att_text(ncid, varid, attName, att)) != NC_NOERR) {
NCprintNCError (status, "NCdataGetTextAttribute");
free(att);
return ((char *) NULL);
}
att[attlen] = '\0';
return (att);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:19,代码来源:NCdata.c
示例15: CMmsgPrint
char *UISelection(Widget widget, char *items, int itemSize, int itemNum) {
int i;
XmString *strings;
if ((strings = (XmString *) calloc(itemNum, sizeof(XmString))) == NULL) {
CMmsgPrint(CMmsgSysError, "Memory Allocation Error in: %s %d", __FILE__, __LINE__);
return (NULL);
}
for (i = 0; i < itemNum; ++i) strings[i] = XmStringCreate(items + i * itemSize, UICharSetNormal);
_UISelection = NULL;
XtVaSetValues(widget, XmNlistItems, strings, XmNlistItemCount, itemNum, NULL);
XtManageChild(widget);
while (UILoop());
XtUnmanageChild(widget);
for (i = 0; i < itemNum; ++i) XmStringFree(strings[i]);
free(strings);
return (_UISelection);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:20,代码来源:UISelect.C
示例16: getDaysSincePlanting
static int getDaysSincePlanting(int DayOfYearModel, int DayOfYearPlanting[numSeasons],int NumGrowingSeasons,const MDIrrigatedCrop * pIrrCrop) {
int ret=-888;
float totalSeasonLenth;
totalSeasonLenth =
pIrrCrop->cropSeasLength[0] +
pIrrCrop->cropSeasLength[1] +
pIrrCrop->cropSeasLength[2] + pIrrCrop->cropSeasLength[3];
int dayssinceplanted ; //Default> crop is not grown!
int i;
for (i = 0; i < NumGrowingSeasons; i++) {
dayssinceplanted = DayOfYearModel - DayOfYearPlanting[i];
if (dayssinceplanted < 0) dayssinceplanted = 365 + (DayOfYearModel-DayOfYearPlanting[i]);
if (dayssinceplanted < totalSeasonLenth) ret = dayssinceplanted;
}
if (ret >totalSeasonLenth) CMmsgPrint (CMmsgDebug, "dayssinceplantedkorrect ?? %i %i \n",ret, DayOfYearModel);
return ret;
}
开发者ID:amiara,项目名称:WBMplus,代码行数:20,代码来源:MDIrrGrossDemand.c
示例17: MDBgcRiverLightDef
int MDBgcRiverLightDef () {
int optID = MFUnset;
const char *optStr;
const char *options [] = { "none", "calculate", (char *) NULL };
if (_MDRiverLightID != MFUnset) return (_MDRiverLightID);
MFDefEntering ("Calculate river light");
if (((optStr = MFOptionGet (MDOptReservoirs)) == (char *) NULL) || ((optID = CMoptLookup ( options, optStr, true)) == CMfailed)) {
CMmsgPrint(CMmsgUsrError,"Reservoir Option not specified! Option none or calculate \n");
return CMfailed;
}
if (optID==1){
// printf ("Resoption=%i\n",optID);
if (((_MDInResStorageID = MFVarGetID (MDVarReservoirStorage, "km3", MFInput, MFState, MFInitial)) == CMfailed) ||
((_MDInResStorageChangeID = MFVarGetID (MDVarReservoirStorageChange, "km3/s", MFInput, MFState, MFBoundary)) == CMfailed))
return CMfailed;
}
//input
if (//((_MDInDischargeID = MDDischargeDef ()) == CMfailed) ||
// ((_MDInSolarRadID = MDSolarRadDef ()) == CMfailed) ||
((_MDInFluxDOCID = MDBgcDOCRoutingDef ()) == CMfailed) ||
((_MDInSolarRadID = MFVarGetID (MDVarSolarRadiation, "MJ/m2/d", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDInDischargeID = MFVarGetID (MDVarDischarge, "m3/s", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInConcDOCID = MFVarGetID (MDVarDOCConcentration, "kg/m3", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverWidthID = MFVarGetID (MDVarRiverWidth, "m", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverbedWidthMeanID = MFVarGetID (MDVarRiverbedWidthMean, "m", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverDepthID = MFVarGetID (MDVarRiverDepth, "m", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInKoppenID = MFVarGetID (MDVarKoppen, MFNoUnit, MFInput, MFState, MFBoundary)) == CMfailed) ||
// output
((_MDPAR2BottomID = MFVarGetID (MDVarPAR2Bottom, "MJ/m2/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDPAR2ReachID = MFVarGetID (MDVarPAR2Reach, "MJ/d", MFOutput, MFState, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDRiverLight) == CMfailed)) return (CMfailed);
MFDefLeaving ("Calculate river light");
return (_MDRiverLightID);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:41,代码来源:MDBgcRiverLight.c
示例18: getCropKc
static float getCropKc(const MDIrrigatedCrop * pIrrCrop, int daysSincePlanted, int curCropStage)
{
float kc;
//Returns kc depending on the current stage of the growing season
if (curCropStage == 0) kc = 0.0; //crop is not currently grown
if (curCropStage == 1) kc = pIrrCrop->cropKc[0];
if (curCropStage == 2) {
int daysInStage = (daysSincePlanted - pIrrCrop->cropSeasLength[0]);
kc = pIrrCrop->cropKc[0] + (daysInStage / pIrrCrop->cropSeasLength[1])*(pIrrCrop->cropKc[1]-pIrrCrop->cropKc[0]);
}
if (curCropStage == 3) kc = pIrrCrop->cropKc[1];
if (curCropStage == 4) {
int daysInStage4 = (daysSincePlanted - (pIrrCrop->cropSeasLength[0] + pIrrCrop->cropSeasLength[1] + pIrrCrop->cropSeasLength[2]));
//kc = pIrrCrop->cropKc[2] - (daysInStage4 / pIrrCrop->cropSeasLength[3]) * abs(pIrrCrop->cropKc[3] - pIrrCrop->cropSeasLength[2]);
kc=pIrrCrop->cropKc[1]+ daysInStage4/ pIrrCrop->cropSeasLength[3] *(pIrrCrop->cropKc[2]-pIrrCrop->cropKc[1]);
//printf ("Len3 %f kc3 %f daysin4 %i KC %f \n" , pIrrCrop->cropSeasLength[3], pIrrCrop->cropKc[3],daysInStage4,kc);
}
if (kc >1.5 ) CMmsgPrint (CMmsgDebug, "kc korrect ?? kc stage dayssinceplanted kc0 kc1 season0length %f %i %i %f %f %f \n",kc, curCropStage, daysSincePlanted, pIrrCrop->cropKc[0],pIrrCrop->cropKc[1], pIrrCrop->cropSeasLength[0]);
return kc;
}
开发者ID:amiara,项目名称:WBMplus,代码行数:21,代码来源:MDIrrGrossDemand.c
示例19: Type
int DBObjData::Read (const char *fileName)
{
FILE *file;
if (strncmp(CMfileExtension(fileName),"nc",2) == 0)
{
Type (DBTypeGridContinuous); // TODO: Limiting to Continuous grid
if (DBImportNetCDF (this,fileName) == DBFault) return (DBFault);
}
else
{
if ((file = fopen (fileName,"r")) == (FILE *) NULL)
{
CMmsgPrint (CMmsgAppError, "File (%s) Opening Error in: %s %d",fileName, __FILE__,__LINE__);
return (DBFault);
}
if (Read (file) == DBFault) return (DBFault);
}
FileName (fileName);
return (DBSuccess);
}
开发者ID:gyelnats,项目名称:RGIS,代码行数:22,代码来源:DBObjReadWrit.C
示例20: _NFentryText
/****************************************************************************************************************
* Entry text
*****************************************************************************************************************/
static void XMLCALL _NFentryText (void *argPtr, const char *str, int len) {
char *whiteChars = " \t\n";
size_t i, start, end;
bool white;
NFdata_t *data;
// NFobject_p object;
XML_Parser parser = (XML_Parser) argPtr;
data = (NFdata_t *) XML_GetUserData (parser);
if (data->Skip) return;
for (start = 0;start < len; start++) {
for (i = 0;i < strlen (whiteChars); ++i)
if (str [start] == whiteChars [i]) { white = true; break; }
if (white == false) break;
white = false;
}
if (start == len) return;
for (end = len;end > 0; end--) {
for (i = 0;i < strlen (whiteChars); ++i)
if (str [end - 1] == whiteChars [i]) { white = true; break; }
if (white == false) break;
white = false;
}
if (end - start + 1 > data->BufferLen) {
if ((data->Buffer = (char *) realloc (data->Buffer,end - start + 1)) == (char *) NULL) {
CMmsgPrint (CMmsgSysError,"Memory allocation error in %s:%d\n\n",__FILE__,__LINE__);
return;
}
data->BufferLen = end - start + 1;
}
strncpy (data->Buffer, str + start, end - start);
data->Buffer [end - start] = '\0';
// TODO Initialize
// object->Notes = CMstrAppend (object->Notes, data->Buffer, "\n");
}
开发者ID:ztessler,项目名称:nFrames,代码行数:42,代码来源:NFparse.c
注:本文中的CMmsgPrint函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论