| aditi88 (14) | |
|
Hey frnds, I have written a html code which is sending data to a c program. But stdin is unable to read that data in c program. It seems stdin doesnot have any data only. Can anybody pls tell me what could be the reason?? Regards, Aditi Code is : WebServer ws; printf("Content-type:text/html\n\n"); char *data = new char[MAX], *text = new char[MAX], *result = new char[MAX]; ofstream fp("/tmp/logg.txt", ios::app); int ch=0,i=0; cout<<"characters are : "; while((ch = fgetc(stdin)) != EOF) { text[i] = (char)ch; fp.put(text[i]); i++; } text[i] = '\0'; fp.close(); strcpy(data,getenv("QUERY_STRING")); strcat(data,text); if(data == NULL) printf("Error! Error in passing data from form to script\n"); else { ws.SendRequest("128.9.54.32",2210); ws.SendData(data,strlen(data),0); ws.ReceiveData(result,4096,0); printf("%s",result); } printf("From web.cgi\n"); delete[] data; delete[] text; delete[] result; exit(0); | |
|
|
|
| aditi88 (14) | |
|
Data was not getting posted properly on from html.....noe issue resolved :) Regards, Aditi | |
|
|
|