在oracle下使用function call c,然后用c执行shell。
现在存在的问题是:function已经成功call c,但c执行shell时,shell没运行。我不使用oracle function时能够正确调用,请问懂这方面问题的高手指点一下,大概问题出在什么地方?

解决方案 »

  1.   

    调试下看看为什么没进去执行shell
      

  2.   

        +1  #include<stdio.h>
        +2  #include<stdlib.h>
        +3  #include<string.h>
        +4  char buf[1024]="";
        +5  char *LISTEN(char *pname)
        +6  {
        +7          /*
        +8          **use shell start process and get the process name to PRONAME
        +9          */
       +10          if(strcmp(pname,"UNISVR")==0)
       +11          {
       +12                  sprintf(buf,"./UNISVR.sh",getenv("TESTSHELL"));
       +13                  int n=system(buf);
       +14          }
       +15          if(strcmp(pname,"SNTLIS")==0)
       +16          {
       +17                  sprintf(buf,"./SNTLIS.sh",getenv("TESTSHELL"));
       +18                  int n=system(buf);
       +19          }
       +20          /*
       +21          ** read PRONAME file to return information
       +22          */
       +23          memset(buf,NULL,strlen(buf));
       +24          FILE *ifp;
       +25          ifp=fopen("/oracle/product/10.2.0/bin/PRONAME","r");
       +26          fgets(buf,1024,ifp);
       +27          fscanf(ifp,"%s",buf);
       +28          fclose(ifp);
       +29          return buf;
       +30  }
    上面是function call c的函数,我以调试过程序也执行了第11,12行,但就是为什么没执行shell,而单用c就可以执行?