Answer the question
In order to leave comments, you need to log in
Error while executing CGI script "premature end of script headers"
I ask for your help, habravchane!
I installed Apache on the machine and wrote a script in C for remote control of a home robot.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include "PortDriver.h"
int main(void)
{
HANDLE h;
char *query;
query=(char*)malloc(sizeof(char)*256);
h=InitPort("\\\\.\\COM2",57600);
query=getenv("QUERY_STRING");
if (h==INVALID_HANDLE_VALUE)
{
printf("Error\n");
return 0;
}
if (strstr(query,"COMM=W")!=0)
{
SendData(h,'W');
}
if (strstr(query,"COMM=A")!=0)
{
SendData(h,'A');
}
if (strstr(query,"COMM=S")!=0)
{
SendData(h,'S');
}
if (strstr(query,"COMM=D")!=0)
{
SendData(h,'D');
}
if (strstr(query,"COMM=Q")!=0)
{
SendData(h,'Q');
}
free(query);
printf("Status: 204 No Change\n");
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question