Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

searchenv - weird behave

Status
Not open for further replies.

giahan

Programmer
Sep 1, 2000
139
0
0
US
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] = &quot;&quot;;
char envvar[100] = &quot;&quot;;

strcpy(envvar, &quot;data&quot;);
printf(&quot;envvar %s\n&quot;, envvar);
strcpy(searchfile_s3b, &quot;test.txt&quot;);
printf(&quot;b/f search for s3b %s\n&quot;, searchfile_s3b);
//_searchenv(searchfile_s3b, envvar, pathbuffer);
_searchenv(searchfile_s3b, envvar, pathbuffer);
if( *pathbuffer != '\0' )
printf( &quot;Path for %s: %s\n&quot;, searchfile_s3b, pathbuffer );
else
printf( &quot;%s not found\n&quot;, searchfile_s3b );
}

void main(int argc, char* argv[])
{
printf(&quot;content-type: text/html\n\n&quot;);
printf(&quot;<html>\n<title>Test Search file</title>\n<body>\n&quot;);
searchfile_func();
printf(&quot;</body></html>&quot;);
}
//****end of file
And here is my html file that calls the searchfile.exe
//********Start file
<html>
<title>test file</title>
<body>
<form method=&quot;POST&quot; action=&quot;../searchfile/Debug/searchfile.exe&quot;>
<input type=&quot;submit&quot; value=&quot;CLICK HERE&quot;>
</form>
</body>

//end file
</html>
GH
 
I got it. The problem is Netscape Server. It does not look at the envvar, it just allows to search files that in the same folder or subfolders of the execute file
It acts different with IIS

GH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top