raj
raj

Reputation: 45

Connect c++ application with an http calls?

is it possible to get the output of an c++ project as http request

eg:http://localhost:8080 

just it need to output an xml or just any output...

Upvotes: 0

Views: 125

Answers (2)

njamesp
njamesp

Reputation: 760

You can use any executable as a CGI script (though they are usually perl or shell scripts).

Make your c++ executable print whatever you need to stdout (cout).

Here is a great into to CGI, and 4.2 tells you that you can make any executable run via CGI.

Upvotes: 1

Thanatos
Thanatos

Reputation: 44334

Yes - this is typically some sort of CGI mechanism. Depending on the software you're using to run your webserver, if it supports CGI, it can be configured to invoke your program when certain URLs are requested. Your program's output to stdout would then be sent back to the HTTP client.

Be careful with this approach, especially if your application takes input from the user: bugs in your program can lead to security vulnerabilities if, for example, you have the possibility of a buffer overflow. Interpreted languages can sometimes offer some protection here.

Upvotes: 1

Related Questions