?? main.cpp
字號:
#include <stdio.h>#include <string.h>#include <time.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include "../include/define.h"#include "mysql/mysql.h"#include "../include/sm_tools.h"#include "../include/sm_db.h"#include "main.h"#define SELF_TYPE "main"#define INIFILE "../config/sm.ini"char SP_ID[20];char db_host[100],db_user[100],db_passwd[100],db_dbname[100];MYSQL *myconn;static int InitPara(){ myconn = NULL; GetProfileString(INIFILE,"DB_LOCAL","HOST","localhost",db_host); GetProfileString(INIFILE,"DB_LOCAL","LOGNAME","root",db_user); GetProfileString(INIFILE,"DB_LOCAL","LOGPASS","",db_passwd); GetProfileString(INIFILE,"DB_LOCAL","DBNAME","NW_SM_TEST",db_dbname); GetProfileString(INIFILE,"COMMON","SP_ID","5566",SP_ID); /*InitPoint(); Initllysgb(); InitTrans(); InitSuanMing(); Initgb(); InitEQALL(); InitChance_new(); InitSendwait(); InitTest(); InitBet18month(); InitZldbp(); Initzhenren(); Initzfy5d(); Initcyds(); Initdianshi(); INItdiantai(); //電臺程序 2006.02.27增加 WCZ 程序kind為:ZD,名稱diantai.cpp*/InitQyzx();InitQgjl(); InitZxcl();InitYsjk();InitPush();InitError();return 0;}static int DoThread(){ int retval,selfadd; FILE *fp_ok; char file_ok[50],day[20]; sprintf(file_ok,"wrong/w%s",getnowdate(day)); while(1) { fp_ok = fopen(file_ok,"w"); if(fp_ok == NULL) { puts("open file wrong"); } fprintf(fp_ok,"begin\n"); fflush(fp_ok); retval=0; /*fprintf(fp_ok,"DoPoint\n"); fflush(fp_ok); retval += DoPoint(); fprintf(fp_ok,"Dollysgb\n"); fflush(fp_ok); retval +=Dollysgb(); fprintf(fp_ok,"DoTrans\n"); fflush(fp_ok); retval +=DoTrans(); fprintf(fp_ok,"DoSuanMing\n"); fflush(fp_ok); retval +=DoSuanMing(); fprintf(fp_ok,"Dogb\n"); fflush(fp_ok); retval +=Dogb(); fprintf(fp_ok,"DoEQALL\n"); fflush(fp_ok); retval +=DoEQALL(); fprintf(fp_ok,"DoChance_new\n"); fflush(fp_ok); retval +=DoChance_new(); fprintf(fp_ok,"DoSendwait\n"); fflush(fp_ok); retval +=DoSendwait(); fprintf(fp_ok,"DoBet18month\n"); fflush(fp_ok); retval +=DoBet18month(); fprintf(fp_ok,"DoTest\n"); fflush(fp_ok); retval +=DoTest(); fprintf(fp_ok,"DoZldbp\n"); fflush(fp_ok); retval +=DoZldbp(); fprintf(fp_ok,"Dozhenren\n"); fflush(fp_ok); retval +=Dozhenren(); fprintf(fp_ok,"Dozfy5d\n"); fflush(fp_ok); retval +=Dozfy5d(); fprintf(fp_ok,"Docyds\n"); fflush(fp_ok); retval +=Docyds(); fprintf(fp_ok,"Dodianshi\n"); fflush(fp_ok); retval +=Dodianshi(); fprintf(fp_ok,"Dodiantai\n"); fflush(fp_ok); retval +=Dodiantai(); */ fprintf(fp_ok,"DoQyzx"); fflush(fp_ok); retval +=DoQyzx(); fprintf(fp_ok,"DoQgjl"); fflush(fp_ok); retval +=DoQgjl(); fprintf(fp_ok,"DoZxcl"); fflush(fp_ok); retval +=DoZxcl(); fprintf(fp_ok,"DoYsjk"); fflush(fp_ok); retval +=DoYsjk(); fprintf(fp_ok,"DoPush"); fflush(fp_ok); retval +=DoPush(); fprintf(fp_ok,"DoError"); fflush(fp_ok); retval +=DoError(); fprintf(fp_ok,"DoExit"); fflush(fp_ok); retval +=DoExit(); fprintf(fp_ok,"end\n"); fflush(fp_ok); //printf("retval=%d",retval); //puts("end"); if(retval == 0) { sleep(2); } fclose(fp_ok); }}int main(int argc,char * argv[]){ InitPara(); /*連接數據庫*/ myconn = dbconnect(db_host,db_user,db_passwd,db_dbname); if(myconn == NULL) { puts("連接數據庫失敗,請查看日志文件!"); return 0; } if(DoThread() != 0) { puts("查詢信息出錯!"); return 0; } return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -