Hi all,
I wrote a simple search file function using searchenv() in MS Visual C++. It works fine and returns the path for me but when I implement it web version (I used Netcape Server), I get nothing return for the path. I try to run the same stuff on IIS webserver, it runs fine. Does anyone know why it happens like that?
I use NT server 4, SP4.
Here is my simple search function
//***** searchfile.cpp ****
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void searchfile_func()
{
char pathbuffer[200];
char searchfile_s3b[50] = "";
char envvar[100] = "";
strcpy(envvar, "data"
;
printf("envvar %s\n", envvar);
strcpy(searchfile_s3b, "test.txt"
;
printf("b/f search for s3b %s\n", searchfile_s3b);
//_searchenv(searchfile_s3b, envvar, pathbuffer);
_searchenv(searchfile_s3b, envvar, pathbuffer);
if( *pathbuffer != '\0' )
printf( "Path for %s: %s\n", searchfile_s3b, pathbuffer );
else
printf( "%s not found\n", searchfile_s3b );
}
void main(int argc, char* argv[])
{
printf("content-type: text/html\n\n"
;
printf("<html>\n<title>Test Search file</title>\n<body>\n"
;
searchfile_func();
printf("</body></html>"
;
}
//****end of file
And here is my html file that calls the searchfile.exe
//********Start file
<html>
<title>test file</title>
<body>
<form method="POST" action="../searchfile/Debug/searchfile.exe">
<input type="submit" value="CLICK HERE">
</form>
</body>
//end file
</html>
GH
I wrote a simple search file function using searchenv() in MS Visual C++. It works fine and returns the path for me but when I implement it web version (I used Netcape Server), I get nothing return for the path. I try to run the same stuff on IIS webserver, it runs fine. Does anyone know why it happens like that?
I use NT server 4, SP4.
Here is my simple search function
//***** searchfile.cpp ****
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void searchfile_func()
{
char pathbuffer[200];
char searchfile_s3b[50] = "";
char envvar[100] = "";
strcpy(envvar, "data"
printf("envvar %s\n", envvar);
strcpy(searchfile_s3b, "test.txt"
printf("b/f search for s3b %s\n", searchfile_s3b);
//_searchenv(searchfile_s3b, envvar, pathbuffer);
_searchenv(searchfile_s3b, envvar, pathbuffer);
if( *pathbuffer != '\0' )
printf( "Path for %s: %s\n", searchfile_s3b, pathbuffer );
else
printf( "%s not found\n", searchfile_s3b );
}
void main(int argc, char* argv[])
{
printf("content-type: text/html\n\n"
printf("<html>\n<title>Test Search file</title>\n<body>\n"
searchfile_func();
printf("</body></html>"
}
//****end of file
And here is my html file that calls the searchfile.exe
//********Start file
<html>
<title>test file</title>
<body>
<form method="POST" action="../searchfile/Debug/searchfile.exe">
<input type="submit" value="CLICK HERE">
</form>
</body>
//end file
</html>
GH