Popen problem cannot be used under CGI

The cgi program written in C language has a function to return the software version number. Because the software version number is not read from the file, it uses the command on linux: /usr/local/bin/ cmsserver//MonitorServer -v is displayed.

So the popen() function is used. Of course, we can also use the system() function to redirect the output of the above command to a file and then read it, but this requires disk reading, which the boss does not want.

The popen() function is used to obtain the output of the command, and the output is sent to the input text type edit box of the web front end. A problem occurs, and the popen function returns Correct, but the return buffer from the popen() function is always failed to pass to the front end.

Later it was discovered that the error message prompted by the web page was “Unterminated string constant” and found the reason. There are 3 reasons for this error found on the Internet:

1. JAVASCRIPT The character language used when quoting Inconsistent.
For example: "); htmlFooter(); end: ret = pclose(fp); free (typetext); free(hwver); return ret;}

The last point is that if you think that in my case, MonitorServer requires a dynamic library to run, then please copy a copy of the dynamic library to your cgi program to run In the directory, otherwise an error will occur.

1. JAVASCRIPT uses inconsistent character languages ​​when quoting.
For example: