Web Hosting Talk







View Full Version : C++ Web Output grabled


MaB
12-01-2002, 11:42 PM
Hi,

Im a perl guru and ive recently jumped into graphical c++ for windows. Now im trying c++ for web output on linux. The program compiles ok, has its little content-type header and a line of text. when i run the compiled program from the command line ir returns the proper:
content-type:text/html

BOOOH

but when i run it from apache and the web it is garbled squares and other lines of code.

Also, i can run a perl script like url.com/path/to/script.pl/arg1/arg2 but if i try to run urlcom/path/to/cprogram/arg1/arg2 i get a 404 not found that it cant find /home/sites/...cprogram/arg1/arg2

Anyone got any ideas?

Thanks (PS No odd error_log or access_Log entries to help debug :()

Thanks

PPS the code is just:

int main (){

printf("content-type:text/html\n\n");
printf ("BOOOH");
return 1;
}


LAST Update
I tried to compile CGIWRAP and when running cgiwrap from the command line the output is ok but when cgiwrap is run via the browser it also gives the garbled output

REAL LAST UPDATE
This code is compiled seperately on another redhat 7.2 machine and gives the same garbled output.

mind21_98
12-02-2002, 06:38 PM
Have you tried putting the script in your cgi-bin directory? Usually, servers will only run CGI scripts/programs that are in that directory. (renaming it to program.cgi instead of just 'program' also works at some hosts)

MaB
12-02-2002, 07:17 PM
We are the host, and run the servers and CGI can run anywhere... i will try the .cgi extention and let you know

MaB
12-02-2002, 07:44 PM
I LOVE YOU :)

I can just use .htaccess to associate that program with cgi :)

thanks so much. :)

mind21_98
12-02-2002, 08:00 PM
I'm glad I could be of help. :)

MaB
12-03-2002, 07:09 PM
How can i use .htaccess to force it to run as a cgi script without the .cgi file - if i want to call it just "test"

Ive done this before i think with Action or AddHandler but i cant remeber how to do it again :(

mind21_98
12-03-2002, 07:45 PM
Try something like this:

Action my-cgi /test

<Files "test">
SetHandler my-cgi
</Files>

MaB
12-03-2002, 07:50 PM
Thanks