这篇教程C++ Fprintf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Fprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ Fprintf函数的具体用法?C++ Fprintf怎么用?C++ Fprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Fprintf函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: MOD_OPTint MOD_OPT(ChkMix)(Option *Opt,Model *Mod){ TYPEOPT* ptOpt=( TYPEOPT*)(Opt->TypeOpt); TYPEMOD* ptMod=( TYPEMOD*)(Mod->TypeModel); int status=OK; if (ptOpt->Maturity.Val.V_DATE<=ptMod->T.Val.V_DATE) { Fprintf(TOSCREENANDFILE,"Current date greater than maturity!/n"); status+=1; }; if ((ptOpt->DownOrUp).Val.V_BOOL==DOWN) { if ( ((ptOpt->Limit.Val.V_NUMFUNC_1)->Compute)((ptOpt->Limit.Val.V_NUMFUNC_1)->Par,ptMod->T.Val.V_DATE)>ptMod->S0.Val.V_PDOUBLE) { Fprintf(TOSCREENANDFILE,"Limit Down greater than spot!/n"); status+=1; }; } if ((ptOpt->DownOrUp).Val.V_BOOL==UP) { if ( ((ptOpt->Limit.Val.V_NUMFUNC_1)->Compute)((ptOpt->Limit.Val.V_NUMFUNC_1)->Par,ptMod->T.Val.V_DATE)<ptMod->S0.Val.V_PDOUBLE) { Fprintf(TOSCREENANDFILE,"Limit Up lower than spot!/n"); status+=1; }; } return status;}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:33,
示例2: MOD_OPTint MOD_OPT(ChkMix)(Option *Opt,Model *Mod){ TYPEOPT* ptOpt=( TYPEOPT*)(Opt->TypeOpt); TYPEMOD* ptMod=( TYPEMOD*)(Mod->TypeModel); int status=OK; if (ptOpt->Maturity.Val.V_DATE<=ptMod->T.Val.V_DATE) { Fprintf(TOSCREENANDFILE,"Current date greater than maturity!/n"); status+=1; }; if ((ptOpt->MinOrElse).Val.V_BOOL==MINIMUM) { if ((ptOpt->PathDep.Val.V_NUMFUNC_2)->Par[4].Val.V_PDOUBLE>ptMod->S0.Val.V_PDOUBLE) { Fprintf(TOSCREENANDFILE,"Minimum greater than spot!/n"); status+=1; }; } if ((ptOpt->MinOrElse).Val.V_BOOL==MAXIMUM) { if ((ptOpt->PathDep.Val.V_NUMFUNC_2)->Par[4].Val.V_PDOUBLE<ptMod->S0.Val.V_PDOUBLE) { Fprintf(TOSCREENANDFILE,"Maximum lower than spot!/n"); status+=1; }; } return status;}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:29,
示例3: WriteListAnalysisvoid WriteListAnalysis(FILE * f, int i, char *list_type){ int k, i1; VARPTR var; i1 = i + 1; AddDeclare1(DEC_INT, "m%d", i1); AddDeclare1(DEC_INT, "n%d", i1); AddDeclare1(DEC_INT, "l%d", i1); Fprintf(f, indent, "GetRhsVar(%d,/"%s/",&m%d,&n%d,&l%d);/n", i1, list_type, i1, i1, i1); for (k = 0; k < nVariable; k++) { var = variables[k]; if ((var->list_el != 0) && (strcmp(var->list_name, variables[i]->name) == 0) && var->present) { Fprintf(f, indent, "/* list element %d %s *//n", var->list_el, var->name); if (RHSTAB[var->type].type != var->type) { fprintf(stderr, "Bug in intersci : Something wrong in RHSTAB/n"); } (*(RHSTAB[var->type].fonc)) (f, var, 0); } }}
开发者ID:rossdrummond,项目名称:scilab,代码行数:25,
示例4: PrintList_hklstatic void PrintList_hkl(void){ int iListFcal; T_ListFcal *lfcal; Fprec d, twotheta; Fprintf(stdout, ">Begin List_hkl/n"); Fprintf(stdout, "# h k l d 2-Theta/n"); lfcal = ListFcal; for (iListFcal = 0; iListFcal < nListFcal; iListFcal++) { if (lfcal->h || lfcal->k || lfcal->l) { twotheta = TwoThetaDeg(lfcal->Q); d = lfcal->Q; if (d != 0) d = 1. / sqrt(d); Fprintf(stdout, " %3d %3d %3d %8.4f %7.3f", lfcal->h, lfcal->k, lfcal->l, d, twotheta); putc('/n', stdout); } lfcal++; } Fprintf(stdout, ">End List_hkl/n"); putc('/n', stdout);}
开发者ID:stefsmeets,项目名称:focus_package,代码行数:31,
示例5: MOD_OPTint MOD_OPT(ChkMix)(Option *Opt,Model *Mod){ TYPEOPT* ptOpt=(TYPEOPT*)(Opt->TypeOpt); TYPEMOD* ptMod=(TYPEMOD*)(Mod->TypeModel); int status=OK; /*Custom*/ if (ptOpt->Maturity.Val.V_DATE<=ptMod->T.Val.V_DATE) { Fprintf(TOSCREENANDFILE,"Current date greater than maturity!/n"); status+=1; }; if ( ((ptOpt->LowerLimit.Val.V_NUMFUNC_1)->Compute)((ptOpt->LowerLimit.Val.V_NUMFUNC_1)->Par,ptMod->T.Val.V_DATE)>ptMod->S0.Val.V_PDOUBLE && (ptOpt->Parisian).Val.V_BOOL==WRONG) { Fprintf(TOSCREENANDFILE,"Limit Down greater than spot!/n"); status+=1; }; if ( ((ptOpt->UpperLimit.Val.V_NUMFUNC_1)->Compute)((ptOpt->UpperLimit.Val.V_NUMFUNC_1)->Par,ptMod->T.Val.V_DATE)<ptMod->S0.Val.V_PDOUBLE && (ptOpt->Parisian).Val.V_BOOL==WRONG) { Fprintf(TOSCREENANDFILE,"Limit Up lower than spot!/n"); status+=1; }; /*EndCustom*/ return status;}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:27,
示例6: PrintPhaseCodestatic void PrintPhaseCode(T_PhaseCode *code){ int iCT, iTab; static int TabSymbol[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', '0' }; Fprintf(stdout, "PhaseCode("); for (iCT = 0; iCT < nActivePhase; iCT++) { if (iCT % 72 == 0) putc('/n', stdout); iTab = (code[iCT] + 9) / 18; if (iTab >= 0 && iTab < (sizeof TabSymbol / sizeof (*TabSymbol))) putc(TabSymbol[iTab], stdout); else putc('~', stdout); } Fprintf(stdout, "/n)");}
开发者ID:stefsmeets,项目名称:focus_package,代码行数:27,
示例7: FSelectPricingint FSelectPricing(char InputFile[MAX_LINE][MAX_CHAR_LINE],int user,Model *pt_model,Option *pt_option,Pricing **pricing,Pricing **result){ int i=-1; char dummy[MAX_CHAR_X3]; if ((strlen(pt_model->ID)+1+strlen(pt_option->ID))>=MAX_CHAR_X3) { Fprintf(TOSCREEN,"%s/n",error_msg[PATH_TOO_LONG]); exit(WRONG); } strcpy(dummy,pt_model->ID); strcat(dummy,"_"); strcat(dummy,pt_option->ID); do { i=i+1; } while ((strcmp(dummy,pricing[i]->ID)!=0) && (pricing[i+1]!=NULL)); if (strcmp(dummy,pricing[i]->ID)==0) { *result=pricing[i]; return ((*result)->CheckMixing)(pt_option,pt_model) ; } Fprintf(TOSCREEN,"No choice available!/n"); return PREMIA_NONE;}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:30,
示例8: VRML_Beginvoid VRML_Begin( FILE *f ){ fprintf( f, VRML_header ); fprintf( f, "children [/n" ); Fprintf( f, "/t/tNavigationInfo { headlight FALSE }/n" ); Fprintf( f, "/t/tDirectionalLight {/n/t/t direction 0 -5 1 }/n/n" );}
开发者ID:rauls,项目名称:iReporter,代码行数:7,
示例9: large_deflateu_long large_deflate (u_char *compr, u_long compr_len, u_char *uncompr, u_long uncompr_len) { z_stream c_stream; /* compression stream */ int err; c_stream.zalloc = (alloc_func)0; c_stream.zfree = (free_func)0; c_stream.opaque = (voidpf)0; err = deflateInit(&c_stream, Z_BEST_SPEED); if (check_error(err, "deflateInit", c_stream.msg)) return 0; c_stream.next_out = compr; c_stream.avail_out = (u_int)compr_len; c_stream.next_in = uncompr; c_stream.avail_in = (u_int)uncompr_len; err = deflate(&c_stream, Z_NO_FLUSH); if (check_error(err, "deflate", c_stream.msg)) return 0; if (c_stream.avail_in != 0) { Fprintf(stderr, "deflate not greedy"); } err = deflate(&c_stream, Z_FINISH); if (err != Z_STREAM_END) { Fprintf(stderr, "deflate should report Z_STREAM_END"); } err = deflateEnd(&c_stream); if (check_error(err, "deflateEnd", c_stream.msg)) return 0; /* Fprintf(stdout, "large_deflate(): OK/n"); */ return c_stream.total_out;}
开发者ID:sedic,项目名称:xcircuit-3.8,代码行数:35,
示例10: mmap_validate_opts/************************************************************************ * * * mmap_validate_opts() - Validate Memory Mapped Test Options. * * * * Description: * * This function verifies the options specified for memory mapped * * file testing are valid. * * * * Inputs: dip = The device information pointer. * * * * Return Value: * * Returns SUCESS / FAILURE = Valid / Invalid Options. * * * ************************************************************************/intmmap_validate_opts (struct dinfo *dip){ int status = SUCCESS; /* * For memory mapped I/O, ensure the user specified a limit, and * that the block size is a multiple of the page size (a MUST!). */ if (mmap_flag) { if (data_limit == INFINITY) { Fprintf ("You must specify a data limit for memory mapped I/O./n"); status = FAILURE; } else if (block_size % page_size) { Fprintf ( "Please specify a block size modulo of the page size (%d)./n", page_size); status = FAILURE; } else if (aio_flag) { Fprintf ("Cannot enable async I/O with memory mapped I/O./n"); status = FAILURE; } else { status = validate_opts (dip); } } return (status);}
开发者ID:wanghao-xznu,项目名称:vte,代码行数:40,
示例11: Fprintfvoid Nuc3ptStru::PrintTheTag(FILE *fp){ G.printTag(fp); Fprintf(fp,"_") ; D.printTag(fp) ; if(strlen(tag)>0) Fprintf(fp,"_%s",tag) ;}
开发者ID:DeanHowarth,项目名称:QUDA-CPS,代码行数:7,
示例12: WriteHeadervoid WriteHeader(FILE * f, char *fname0, char *fname){ Fprintf(f, indent, "/nint %s%s(char *fname)/n", fname0, fname); Fprintf(f, indent, "{/n"); indent++; WriteDeclaration(f);}
开发者ID:rossdrummond,项目名称:scilab,代码行数:7,
示例13: flags_set_sync_p2static voidflags_set_sync_p2( sync_vars_t *svars, sync_rec_t *srec, int t ){ int nflags, nex; nflags = (srec->flags | srec->aflags[t]) & ~srec->dflags[t]; if (srec->flags != nflags) { debug( " pair(%d,%d): updating flags (%u -> %u)/n", srec->uid[M], srec->uid[S], srec->flags, nflags ); srec->flags = nflags; Fprintf( svars->jfp, "* %d %d %u/n", srec->uid[M], srec->uid[S], nflags ); } if (t == S) { nex = (srec->status / S_NEXPIRE) & 1; if (nex != ((srec->status / S_EXPIRED) & 1)) { if (nex && (svars->smaxxuid < srec->uid[S])) svars->smaxxuid = srec->uid[S]; Fprintf( svars->jfp, "/ %d %d/n", srec->uid[M], srec->uid[S] ); debug( " pair(%d,%d): expired %d (commit)/n", srec->uid[M], srec->uid[S], nex ); srec->status = (srec->status & ~S_EXPIRED) | (nex * S_EXPIRED); } else if (nex != ((srec->status / S_EXPIRE) & 1)) { Fprintf( svars->jfp, "// %d %d/n", srec->uid[M], srec->uid[S] ); debug( " pair(%d,%d): expire %d (cancel)/n", srec->uid[M], srec->uid[S], nex ); srec->status = (srec->status & ~S_EXPIRE) | (nex * S_EXPIRE); } }}
开发者ID:leifwalsh,项目名称:isync,代码行数:26,
示例14: check_errorint check_error(int err, char *prompt, char *msg) { if (err != Z_OK) { Fprintf(stderr, "%s error: %d", prompt, err); if (msg) Fprintf(stderr, "(%s)", msg); Fprintf(stderr, "/n"); return 1; } return 0;}
开发者ID:sedic,项目名称:xcircuit-3.8,代码行数:9,
示例15: FSelectTestint FSelectTest(char InputFile[MAX_LINE][MAX_CHAR_LINE],int user,Planning *pt_plan, Pricing *pt_pricing, Option *opt,Model *mod,PricingMethod *met,DynamicTest **test){ int i,ii,isub,k,j; DynamicTest** list; DynamicTest* dummy; char line[MAX_CHAR_LINE]; if (pt_plan->Action=='t') { Fprintf(TOSCREEN,"/n_______________________TEST CHOICE:/n/n"); list=pt_pricing->Test; i=0;isub=0; dummy=*list; while ( dummy !=NULL) { if( (dummy->CheckTest)(opt,mod,met) == OK) { for(ii=0;ii<MAX_LINE;ii++){ j=0; while(j<=(signed)(strlen(InputFile[ii])-strlen((pt_pricing->Test[i])->Name))) { if( (j==0 || (j>0 && InputFile[i][j-1]==' ')) && ( InputFile[i][j+strlen((pt_pricing->Test[i])->Name)] == ' ' || InputFile[i][j+strlen((pt_pricing->Test[i])->Name)] == '/0') ){ for(k=j;k<j+(signed)strlen((pt_pricing->Test[i])->Name);k++) line[k-j] = InputFile[ii][k]; line[j+(signed)strlen((pt_pricing->Test[i])->Name)]='/0'; if (StrCasecmp((pt_pricing->Test[i])->Name,line) == 0){ *test=pt_pricing->Test[i]; (*test)->Init(*test, opt); goto ok; } } j++; } } isub++; } i=i+1; list++;dummy=*list; } if (isub==0) { Fprintf(TOSCREEN,"No test available!/n"); } else { Fprintf(TOSCREEN,"No tests found, exiting..../n"); } }ok: return OK;}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:56,
示例16: DoSitePhasesvoid DoSitePhases(void){ int iCT, iCTD, code; T_CodeTransl *CT; T_CTData *CTD; Fprec CC, R; if (nSite < 1) return; PrepListSE(); SiteCT_Fcal(CodeTransl, nActivePhase); CalcCCandR(CodeTransl, nActivePhase, &CC, &R); Fprintf(stdout, "# SiteCT_Fcal CC = %.6g R = %.3f/n/n", CC, R); CT = CodeTransl; for (iCT = 0; iCT < nActivePhase; iCT++) { Phi2Phi360(CT->FcalPhi, CT->Phi360Fcal); if (Debug0) /* Debug: Print SitePhases */ Fprintf(stdout, "SP %3d %3d %3d %3d %8.3f/n", CT->FobsRaw->h, CT->FobsRaw->k, CT->FobsRaw->l, CT->Phi360Fcal, CT->FcalPhi / PIover180); if (CT->nCTData < 1) InternalError("CT->nCTData < 1"); CTD = CT->CTData; code = CT->Phi360Fcal - CTD->TH; if (code < 0) code += 360; if (CT->FobsRaw->PhaseRestriction >= 0) { if (code != 0 && code != 180) CheckRestrictedPhase(CT, &code); } for (iCTD = 0; iCTD < CT->nCTData; iCTD++) { CTD->TH += code; if (CTD->TH >= 360) CTD->TH -= 360; CTD++; } CT++; } FreeListSE();}
开发者ID:stefsmeets,项目名称:focus_package,代码行数:55,
示例17: ListRestCondvoid ListRestCond(FILE *fpout, T_hklCond *rst, int rstn, int debug){ int i,j,n,m; char hkl[3]="hkl"; int x[3]; int S[3][3]; int first; char buf[128]; Fprintf(fpout, "Reflections with phase restriction/n"); for(m=0;m<rstn;m++,rst++) { if (!debug && !rst->Exist ) continue; if (debug) Sprintf(buf,"%02d%c ", rst->iSymTr, rst->Exist?' ':'-'); else buf[0]=0; (void) memcpy(S,rst->Mx,sizeof(S)); (void) memcpy(x,rst->Gl,sizeof(x)); for(j=0; j<3; j++){ for(n=i=0; i<3; i++) if((n=S[i][j]) != 0) break; if(i==3) Sprintf(&buf[strlen(buf)],"0"); else { if (n==1) Sprintf(&buf[strlen(buf)],"%1c",hkl[i]); else if (n==-1) Sprintf(&buf[strlen(buf)],"-%1c",hkl[i]); else Sprintf(&buf[strlen(buf)],"%d%1c",n,hkl[i]); } } n = rst->Denom; Sprintf(&buf[strlen(buf)],": "); if(!rst->Exist) Sprintf(&buf[strlen(buf)],"<"); for(i=0,j=0; i<3; i++) j+=abs(x[i] % n); if (j) { Sprintf(&buf[strlen(buf)],"%d deg (",180/n); for(i=0,first=1; i<3; i++) if(x[i] % n) { if(x[i] <0) Sprintf(&buf[strlen(buf)],"-"); else if (!first) Sprintf(&buf[strlen(buf)],"+"); if(abs(x[i]) != 1) Sprintf(&buf[strlen(buf)],"%1d",abs(x[i])); first=0; Sprintf(&buf[strlen(buf)],"%1c",hkl[i]); } Sprintf(&buf[strlen(buf)],")"); } else { Sprintf(&buf[strlen(buf)],"0 deg"); } if(!rst->Exist) Sprintf(&buf[strlen(buf)],">"); Fprintf(fpout, " %s/n", buf); } putc('/n', fpout);}
开发者ID:stefsmeets,项目名称:focus_package,代码行数:55,
示例18: OptOpointervoid OptOpointer(FILE *f,VARPTR var){ Fprintf(f,indent++,"if ( %sok == 0) {/n",var->name); Fprintf(f,indent,"%spos=iopos=iopos+1;/n",var->name); Fprintf(f,indent,"CreateSCO(iopos,&lr%d,%s);/n", var->stack_position,data); AddDeclare1(DEC_INT,"lr%d",var->stack_position); Fprintf(f,--indent,"}/n");}
开发者ID:rossdrummond,项目名称:scilab,代码行数:11,
示例19: calcmomvoid AlgFourierProp::ft(FILE *fp,MomentaList& mlist){ char *fname="ft(FILE*,MomentaList&)"; VRB.Func(cname,fname); //---------------------------------------------------------------- // begin loop over momenta //---------------------------------------------------------------- int nmom; for( nmom=0; nmom < mlist.size(); nmom++ ) { //------------------------------------------------------------ // Calculate single momenta //------------------------------------------------------------ momprop=Float(0.0); calcmom(mlist[nmom]); //------------------------------------------------------------ // Global sum //------------------------------------------------------------ // 288 = 4 x 3(src) x 4 x 3(snk) x 2(re/im) // the final argument means which direction to exclude. // here 99 means NO exclusion and end up to be a global sum slice_sum((Float*)&momprop, 288, 99); //------------------------------------------------------------ // Output to file //------------------------------------------------------------ int s1,c1,s2,c2; Fprintf(fp,"MOMENTUM= %d %d %d %d /n", mlist[nmom].x(), mlist[nmom].y(), mlist[nmom].z(), mlist[nmom].t() ); for( s1=0; s1<4; ++s1){ for( c1=0; c1<3; ++c1){ for( s2=0; s2<4; ++s2){ for( c2=0; c2<3; ++c2){ Fprintf(fp, "%-25.15e %-25.15e /n", (Float)momprop.wmat().d[s1].c[c1].d[s2].c[c2].real(), (Float)momprop.wmat().d[s1].c[c1].d[s2].c[c2].imag()); } } } } } // end loop over momenta}
开发者ID:DeanHowarth,项目名称:QUDA-CPS,代码行数:52,
示例20: PrintProfilestatic void PrintProfile(const Fprec *ProfileCounts, int nProfileSteps, const T_StdPeak *StdPeak){ int iPS; Fprec TT, Counts, ScaleF, MaxScaledCounts, ESD; Fprintf(stdout, ">Begin stepscan/n"); Fprintf(stdout, "@with g0/n"); ScaleF = ProfileScaleFactor(ProfileCounts, nProfileSteps, StdPeak); MaxScaledCounts = 0.; for (iPS = 0; iPS < nProfileSteps; iPS++) { TT = iPS * ProfileStep; if (TT + ProfileStep * .5 < ProfileStart) continue; if (TT - ProfileStep * .5 > ProfileEnd) break; Counts = ProfileBackground + ProfileCounts[iPS] * ScaleF; ESD = AppSqrt(Counts); if (ESD < 0.001) ESD = 0.001; Fprintf(stdout, "%12.3f %12.2f %12.3f/n", TT, Counts, ESD); if (MaxScaledCounts < Counts) MaxScaledCounts = Counts; } if (MaxScaledCounts == 0.) MaxScaledCounts = ProfileReferenceMax; if (MaxScaledCounts == 0.) MaxScaledCounts = 1.; Fprintf(stdout, "&/n"); Fprintf(stdout, "@autoscale/n"); Fprintf(stdout, "@ world xmin %.6g/n", ProfileStart); Fprintf(stdout, "@ world xmax %.6g/n", ProfileEnd); Fprintf(stdout, "@ world ymin %.6g/n", 0.); Fprintf(stdout, "@ world ymax %.6g/n", MaxScaledCounts); Fprintf(stdout, ">End stepscan/n"); putc('/n', stdout);}
开发者ID:stefsmeets,项目名称:focus_package,代码行数:52,
示例21: WriteCrossCheckvoid WriteCrossCheck(FILE * f){ int i, j; VARPTR var; Fprintf(f, indent, "/* cross variable size checking *//n"); for (i = 0; i < nVariable; i++) { var = variables[i]; if (var->type == DIMFOREXT) { if (var->nfor_name > 1) { for (j = 1; j < var->nfor_name; j++) { /** we do not check square variables : this is done elsewhere */ /* we do not check external values since they are not known here */ if ((var->for_name_orig[j] != var->for_name_orig[j - 1]) && (var->for_name[j - 1][1] != 'e' && var->for_name[j][1] != 'e')) { Fprintf(f, indent, "CheckDimProp(%d,%d,%s != %s);/n", var->for_name_orig[j - 1], var->for_name_orig[j], var->for_name[j - 1], var->for_name[j]); } } } } else if (var->type == SCALAR) { /** some dimensions are given by a scalar input argument **/ if (var->nfor_name > 1) { for (j = 1; j < var->nfor_name; j++) { int dim = 2; if (var->for_name[j][0] == 'm') dim = 1; if (var->for_name[j][1] != 'e') /* do not check external variables */ { if (strncmp(var->for_name[0], "istk", 4) == 0) Fprintf(f, indent, "CheckOneDim(%d,%d,%s,*%s);/n", var->for_name_orig[j], dim, var->for_name[j], var->for_name[0]); else Fprintf(f, indent, "CheckOneDim(%d,%d,%s,%s);/n", var->for_name_orig[j], dim, var->for_name[j], var->for_name[0]); } } } } } /* * FCprintf(f,"/ * cross formal parameter checking/n"); * FCprintf(f," * not implemented yet * //n"); */}
开发者ID:rossdrummond,项目名称:scilab,代码行数:51,
示例22: Show_model_gen/** * Generic function to replace the Show member function of * the model structures * * @param user : an integer TOSCREEN or TOFILE * @param pt_plan : pointer the planning structure * describing what to do * @param model : pointer to the model instance */int Show_model_gen(int user,Planning *pt_plan,Model *model) { void* pt=(model->TypeModel); VAR *var = ((VAR*)pt); VAR _bs; int nvar = model->nvar, i, j; char *id = NULL; Fprintf(user,"##Model:%s/n",model->Name); for (i=0; i<nvar; i++) { PrintVar(pt_plan,user,&(var[i])); if (strncmp(var[i].Vname, "Annual Interest Rate", 20) == 0 || strncmp(var[i].Vname, "Annual Dividend Rate", 20) == 0 ) { if (id==NULL) { if ((id=malloc(33*sizeof(char)))==NULL) return MEMORY_ALLOCATION_FAILURE; } _bs.Vtype=DOUBLE; _bs.Val.V_DOUBLE=log(1+var[i].Val.V_DOUBLE/100); strcpy(id, "-->Instantaneous"); strcat(id, &(var[i].Vname[6])); _bs.Vname = id; _bs.Viter=FORBID; _bs.setter = NULL; _bs.Vsetable = SETABLE; if(var[i].Vtype==PNLVECT) { strcat(id, ": "); Fprintf(user, id); for(j=0; j<var[i].Val.V_PNLVECT->size; j++) { _bs.Val.V_DOUBLE=log(1+var[i].Val.V_PNLVECT->array[j]/100); Fprintf(user, "%f ", _bs.Val.V_DOUBLE); } Fprintf(user, "/n"); } else { _bs.Val.V_DOUBLE=log(1+var[i].Val.V_DOUBLE/100); PrintVar(pt_plan,user,&_bs); } } } if (id!=NULL) {free(id); id=NULL;} return (model->Check)(user,pt_plan,model);}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:59,
示例23: upi_stm1_stat_getWP_status upi_stm1_stat_get(WP_U32 stm1id,STRU_UPI_STATICS *p){ WP_status status; WP_U16 i; STRU_UPI_STATICS pos_fr; STRU_SET_INITAIL_CONFIG *initial_cfg = npu_get_initial_cfg_info(); WP_U32 line_index_base,line_index_counts; if(initial_cfg->stru_stm1_cfg_info[stm1id].E1T1type == NPU_MODE_E1) { line_index_base = stm1id*N_UFE_MAX_LINES_E1/2; line_index_counts = (1+stm1id)*N_UFE_MAX_LINES_E1/2; } else { line_index_base = stm1id*N_UFE_MAX_LINES_T1/2; line_index_counts = (1+stm1id)*N_UFE_MAX_LINES_T1/2; } if(NPU_VALID == initial_cfg->stru_stm1_cfg_info[stm1id].stm1Valid) { memset (&pos_fr, 0, sizeof(STRU_UPI_STATICS)); for(i = line_index_base; i < line_index_counts; i ++) { if(NPU_VALID == initial_cfg->stru_stm1_cfg_info[stm1id].trunk_info[i-line_index_base].trunkValid) { memset(p, 0, sizeof(STRU_UPI_STATICS)); status = upi_stat_get_by_trunk(i,p); if(-1 == status) { continue; } if (status) { Fprintf("Error upi_stat_get_by_trunk!/n"); return status; } struct_upi_statics_add(&pos_fr, p); } } memcpy((void *)p,(void *)&pos_fr,sizeof(pos_fr)); } else { Fprintf("This stm1 %d is not configed!/n",stm1id); return -1; } return WP_OK;}
开发者ID:morrisxd,项目名称:morrix-project-name,代码行数:50,
示例24: process_file/* Open the given file, read & merge the colormap, convert the tiles. */static voidprocess_file(char *fname){ unsigned long count; if (!fopen_text_file(fname, RDTMODE)) { Fprintf(stderr, "can't open file /"%s/"/n", fname); exit(1); } merge_text_colormap(); count = convert_tiles(&curr_tb, header.ntiles); Fprintf(stderr, "%s: %lu tiles/n", fname, count); header.ntiles += count; fclose_text_file();}
开发者ID:chasonr,项目名称:unnethack-i18n,代码行数:16,
示例25: FixMethodint FixMethod(Planning *pt_plan, PricingMethod *pt_method){ int i,j; char msg,answer; if (pt_plan->NumberOfMethods == 0) return OK; for (j=0; j<pt_plan->VarNumber && pt_plan->Par[j].Location->Vtype!=PREMIA_NULLTYPE; ++j){ for (i=0; pt_method->Par[i].Vtype!=PREMIA_NULLTYPE; ++i){ if (!strcmp(pt_method->Par[i].Vname,pt_plan->Par[j].Location->Vname)) { pt_plan->Par[j].Location = &pt_method->Par[i]; pt_method->Par[i].Viter=ALREADYITERATED+j; return DONOTITERATE; } else if (CompareParameterNames(pt_method->Par[i].Vname,pt_plan->Par[j].Location->Vname)==OK) { Fprintf(TOSCREEN,"/nWould you like to iterate /"%s/" like /"%s/" /n/t/t (ok: Return, no: n) ? /t",pt_method->Par[i].Vname, pt_plan->Par[j].Location->Vname); answer = (char)tolower(fgetc(stdin)); msg = answer; while( (answer != '/n') && (answer != EOF)) answer = (char)fgetc(stdin); if (msg=='/n') { pt_plan->Par[j].Location = &pt_method->Par[i]; pt_method->Par[i].Viter=ALREADYITERATED+j; return DONOTITERATE; } } else if (pt_method->Par[i].Vtype == pt_plan->Par[j].Location->Vtype) { Fprintf(TOSCREEN,"/nWould you like to iterate /"%s/" like /"%s/" /n/t/t (ok: Return, no: n) ? /t",pt_method->Par[i].Vname, pt_plan->Par[j].Location->Vname); answer = (char)tolower(fgetc(stdin)); msg = answer; while( (answer != '/n') && (answer != EOF)) answer = (char)fgetc(stdin); if (msg=='/n') { pt_plan->Par[j].Location = &pt_method->Par[i]; pt_method->Par[i].Viter=ALREADYITERATED+j; return DONOTITERATE; } } } } return OK;}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:48,
示例26: FMoreActionint FMoreAction(char InputFile[MAX_LINE][MAX_CHAR_LINE],int *count){ //char msg='p'; int i0=0,i,j; //int listline[MAX_LINE]; if (*count==(MAX_METHODS-1)) { Fprintf(TOSCREEN,"/n Max Number of Methds Reached!/n"); //msg='n'; }else{ i0=0; for(i=0;i<MAX_LINE;i++){ if(strlen(InputFile[i])>1){ j=0; while(isalpha(InputFile[i][j])==0) j++; if(((InputFile[i][j]=='M') || (InputFile[i][j]=='m')) && ((InputFile[i][j+1]=='A') ||(InputFile[i][j+1]=='a'))){ //listline[i0]=i; i0++; } } } } if(i0==(*count)) return WRONG; else{ (*count)++; return OK; }}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:33,
注:本文中的Fprintf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FrameRect函数代码示例 C++ FoundTarget函数代码示例 |