hi all,
I've got a problem with gets().
My program (cgi) lives on a web server and takes input from a form.
However when it is invoked it just hangs and times out. I'm told by an expert that the problem is with gets() which expects input from stdin ie the keyboard . ie it hangs waiting for someone to hit a key. In the context of the server it is going to wait for a long time (which it does). This makes sense to me BUT what confuses me is that it works ok at home, with the browser on one pc and a server on another (httpd) and my prog in the cgi bin.
Why doesn't it hang at home waiting for a keystroke ? Whats the difference.
here is my problem code
Code:
int main()
{
char s[2000]; // array for gets
gets(s);
/*takes input from form and puts it in s, which is a param to the parsers process () and process2().
PROBLEM HERE*/
process(s);
process2(s);
return 0;
}
I have a weak grasp of what going on here. Is the above explanation ok?
What I really mean is, is there a simple way out ie another function to replace gets() in the context of CGI
Any help would be greatly appreciated