vs_integration/src/SocketConnection.cpp
//--------------------------------------------------------------------------------------------
// This fuction will execute the mrg_diff to create diff file.
//---------------------------------------------------------------------------------------------
This fuction will execute the mrg_diff to create diff file.
This fuction will execute the mrg_diff to create diff file .
void SocketConnection::MakeDiff(CString& localfile, CString& modelfile, CString& diffile) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
char* root;
CString cmd;
  root = getenv("CODE_ROVER_HOME");
  if(root==NULL) 
	  root = getenv("PSETHOME");
  if((root==NULL ) || (strlen(root)==0)) {
      cmd="C:/Discover/Bin/mrg_diff";
  } else {
      cmd=root;
	  cmd+="/bin/mrg_diff";
  }
  cmd.Replace("\\","/");
  cmd.Replace("//","/");
  if(cmd.Find(" ")>0) cmd="\""+cmd+"\"";
  cmd+=" ";
  cmd+="\"";
  cmd+=modelfile;
  cmd+="\"";
  cmd+=" ";
  cmd+="\"";
  cmd+=localfile;
  cmd+="\"";
  cmd+=" ";
  cmd+="\"";
  cmd+=diffile;
  cmd+="\"";
  memset(&si,0,sizeof(STARTUPINFO));
  si.hStdInput  = GetStdHandle(STD_INPUT_HANDLE);
  si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
  si.hStdError  = GetStdHandle(STD_ERROR_HANDLE);
  si.dwFlags    = STARTF_USESTDHANDLES;
  si.cb=sizeof(STARTUPINFO);
  putenv("DIS_NLUNIXSTYLE=1");
  if(::CreateProcess(NULL,cmd.GetBuffer(10),NULL,NULL,FALSE,CREATE_NO_WINDOW,NULL,NULL,&si,&pi)==FALSE) {
	  return;
  }
  WaitForSingleObject(pi.hProcess,INFINITE);
  CloseHandle(pi.hProcess);
  return;
}
void SocketConnection :: MakeDiff ( CString & localfile , CString & modelfile , CString & diffile ) { STARTUPINFO si ; PROCESS_INFORMATION pi ; char * root ; CString cmd ; root = getenv ( " " ) ; if ( root == NULL ) root = getenv ( " " ) ; if ( ( root == NULL ) || ( strlen ( root ) == 0 ) ) { cmd = " " ; } else { cmd = root ; cmd += " " ; } cmd . Replace ( " \\ " , " " ) ; cmd . Replace ( " " , " " ) ; if ( cmd . Find ( " " ) > 0 ) cmd = " \" " + cmd + " \" " ; cmd += " " ; cmd += " \" " ; cmd += modelfile ; cmd += " \" " ; cmd += " " ; cmd += " \" " ; cmd += localfile ; cmd += " \" " ; cmd += " " ; cmd += " \" " ; cmd += diffile ; cmd += " \" " ; memset ( & si , 0 , sizeof ( STARTUPINFO ) ) ; si . hStdInput = GetStdHandle ( STD_INPUT_HANDLE ) ; si . hStdOutput = GetStdHandle ( STD_OUTPUT_HANDLE ) ; si . hStdError = GetStdHandle ( STD_ERROR_HANDLE ) ; si . dwFlags = STARTF_USESTDHANDLES ; si . cb = sizeof ( STARTUPINFO ) ; putenv ( " " ) ; if ( :: CreateProcess ( NULL , cmd . GetBuffer ( 10 ) , NULL , NULL , FALSE , CREATE_NO_WINDOW , NULL , NULL , & si , & pi ) == FALSE ) { return ; } WaitForSingleObject ( pi . hProcess , INFINITE ) ; CloseHandle ( pi . hProcess ) ; return ; }
This fuction will execute the mrg_diff to create diff file.
This fuction will execute the mrg_diff to create diff file .