资源描述:
《labwindows 程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#include#include#include#include#include#include#include"first.h"#defineport1#defineBUF_STRING512ViSessiondefaultRM;ViSessionDataAcqu;intCommInit(void);intComm_Read(char*pszTemp);int
2、Comm_Write(char*pszTemp);intComm_Close(void);charpath_file[512]="";charpath_result[512]="";FILE*pfile;FILE*presult;staticintpanelHandle,panelHandle1,panelHandle2;inttest(void);intgetpn(char*pn);voidexcut(void);charINPN[100]="",PN[100]="",SN[100]="",MAX[20]="",M
3、IN[20]="",F_MAX[20]="",F_MIN[20]="",getchr[512]="";floatv_value,f_value;unsignedintflagpn;charread[500]="",send[30]="",cmd[200]="";char*trim(char*src){inti=0;char*begin=src;while(src[i]!=' '){if(src[i]!=''){break;}else{begin++;}i++;}for(i=strlen(src)-1;i>=0;i-
4、-){if(src[i]!=''){break;}else{src[i]=' ';}}returnbegin;};intmain(intargc,char*argv[]){chartemp_path[512]="";interr=0;if(InitCVIRTE(0,argv,0)==0)return-1;if((panelHandle=LoadPanel(0,"first.uir",PANEL))<0)return-1;SetCtrlAttribute(PANEL,PANEL_TEXTBOX,ATTR_VISIBL
5、E,0);SetCtrlAttribute(PANEL,PANEL_CMD_QUIT,ATTR_VISIBLE,0);SetCtrlAttribute(PANEL,PANEL_CMD_R,ATTR_VISIBLE,0);DisplayPanel(panelHandle);GetProjectDir(temp_path);sprintf(path_file,"%s%s",temp_path,"\PRO");sprintf(path_result,"%s%s",temp_path,"\result");if((pan
6、elHandle1=LoadPanel(panelHandle,"first.uir",PANEL_2))<0)return-1;DisplayPanel(panelHandle1);if(!err)err=CommInit();if(!err)err=test();if(!err)RunUserInterface();if(!err)err=Comm_Close();DiscardPanel(panelHandle);return0;}intgetpn(char*pn){intlen,i,flag=0;char*d
7、est,*temp;memset(PN,0,100);pfile=fopen(path_file,"r");while(!feof(pfile)){fgets(getchr,BUF_STRING-1,pfile);temp=trim(getchr);len=strlen(getchr);for(i=len-1;i>=0;i--){if(!isalnum(getchr[i])){getchr[i]=NULL;}elsei=-1;}dest=strchr(temp,'');if(!dest){i=strlen(temp)
8、;strncpy(PN,temp,i-1);PN[i]=' ';strcpy(MIN,"0");strcpy(MAX,"0");strcpy(F_MIN,"0");strcpy(F_MAX,"0");gotoover;}else{i=dest-temp;strncpy(PN,temp,i);PN[i]=' ';temp=trim(dest)