原创 cvi 下借助dos命令比较两个文件

2011-10-17 11:36 2609 6 6 分类: 工业电子

#include <ansi_c.h>
#include <cvirte.h>  
#include <userint.h>
#include "cmd.h"

static int panelHandle;

int main (int argc, char *argv[])
{
 if (InitCVIRTE (0, argv, 0) == 0)
  return -1; /* out of memory */
 if ((panelHandle = LoadPanel (0, "cmd.uir", PANEL)) < 0)
  return -1;
 DisplayPanel (panelHandle);
 RunUserInterface ();
 DiscardPanel (panelHandle);
 return 0;
}

int CVICALLBACK QuitCallback (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:
   QuitUserInterface (0);
   break;
 }
 return 0;
}

int CVICALLBACK sendCallback (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 FILE *fp;
 char buffer[200];
 switch (event)
 {
  case EVENT_COMMIT:
  // system("cd\");
  // system("cd e:\\job\\load"); 
   system("cmd /c fc E:\\job\\SBBU\\load\\a.txt E:\\job\\SBBU\\load\\c.txt > E:\\job\\SBBU\\load\\cmp.txt");
   fp = fopen("E:\\job\\SBBU\\load\\cmp.txt","r");
   fgets(buffer, 199, fp);
   memset(buffer, 0, sizeof(buffer));
   fgets(buffer, 199, fp);
   if(strstr(buffer, "no differences encountered"))
    MessagePopup("the result", "SAME!!!");
   else
    MessagePopup("the result", "DIFFERENT!!!");
    // system("cmd /c ipconfig /all >1.txt");
   break;
 }
 return 0;
}

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
6
关闭 站长推荐上一条 /3 下一条