how to link c++ program with HTML page? - c++

i am working on php...!!
Is it possible to link HTML page to c++/c at back end.
means instead of php script i want to run c/c++
if Yes How??

Check CGI and FastCGI technologies.

CGI is your best bet if the C++ program is an executable. If you want to use a C++ library from PHP you will need to write an extension. An example of this can be found at http://devzone.zend.com/article/4486

What you are after is CGI.

I recommend the book Extending and Embedding PHP by Sara Goleman link
It is probably the best resource I have found on linking C++ libraries / routines to user space PHP functions.

Related

Library to download a file from a web site?

Say I have this file:
http://www.example.com/somepic.png
Is there a cross platform C or C++ library that could easily allow me to download it to a specified directory?
Thanks
You can use libcurl to do this.
Besides itself, the GNU libmicrohttpd Web site lists several alternatives.

C++ Library for TCP/IP Like WebClient/HttpWebRequest in C#

Is there any C++ Library that can download data from internet when we provide a URL? I am currently learning C++ and wish to start from making use of such library in my application. Please help.
Thanks
Yes, libcurl.

C++ Reads/Writes XML without CLR

I know this is a very stupid question and I'm very new to C++.
I'm developing Starcraft AI, it is DLL file. I'm trying to use XML to gather some data to the bot, however whenever I build the DLL with /clr option. The bot doesn't load properly. So, my question is what is CLR and is there a way to read/write XML without using /clr build option.
Thanks so much.
The /clr compiler option enables the
use of Managed Extensions for C++ and
creates an output file that will
require the .NET Framework common
language runtime at run time.
(from MSDN)
Starcraft is probably not developed under CLR (.NET Framework runtime).
I've used the free tinyxml library from C++ code - it was quick to get running and reasonably efficient. Well, about as efficient as it's possible for XML to be, anyway.
Starcraft probably won't run .NET binaries. You would have to either write your own XML parser, which probably isn't for you seeing as you are new to C++, or find a C++ library that can do it for you.
Example of one:
http://sourceforge.net/projects/tinyxml/

What API/SDK to use for this Windows Application?

I'm going to create a utility with GUI that will run on Windows operating systems.
It should require minimum (or zero!) amount of additional libraries, files or DLLs to run because it will be executed from an installer. Because of this, i don't want to use .NET for it will require user to install .NET Framework. I know today, most of Windows installed system come with .NET Framework but in my case i cannot be sure.
The utility will...
send some data to a web site and
parse the returning data,
collect some hardware info, like MAC address,
CPU type and make, hard-disk serial
number
I suppose native Win32 API could be used for all of those above, but instead of hassling with Win32, i'd prefer using a more developer friendly API, or SDK.
Thanks in advance.
Win32 API is the only way, and of course there are standard API - for sending data over the internet, you could use WinInet.lib/dll, to obtain information about the MAC, you could use the GetAdaptersInfo by using Iphlpapi.lib/dll,(here's a link on how to use it) for the Hard disk serial number you could use GetVolumeInformation by using kernel32.lib/dll. For the CPU Id, you might look into GetSystemInfomation
Edit: There's a C++ code, but you can easily derive a wrapper from this site Unfortunately, with WinAPI is not easy, no such thing as RAD with WinAPI but what you gain out of it is lightweight code instead of relying on SDK's, frameworks and dragging buggy dll's around with your application.
Hope this helps,
Best regards,
Tom.
You can statically link most C++ GUI libraries - even MFC. Personally, I recommend WTL, wihich is very light and header-only.
If what you want is minimum dependency with external files or DLLs you could statically compile all the required DLLs with the tool exe. Then you could use something like Visual C++ to develop such tool.
WTL is perfect for this sort of application and I am surprised more people aren't recommending it. You can also statically link with the CRT and hey presto - no dependencies and a very small EXE.
Delphi (now by Embarcadero) would do the job, creating a .exe file with no dependencies, and it is much easier to work with than the raw Win32 API.
If you don't like Object Pascal, you could try C++ Builder instead.
For the GUI you can either build your application with MFC (statically linked) or use a HTML based dialog that you can interact with using COM. (It is even possible to interact with javascript present in the page displayed by the dialog).
For the specific requirement that you do have, I feel Win32 API is the only way out.
Use MFC and statically link to it. No runtime dependancies need to be installed.

How can I embed Perl inside a C++ application?

I would like to call Perl script files from my c++ program.
I am not sure that the people I will distribute to will have Perl installed.
Basically I'm looking for a .lib file that I can use that has an Apache like distribution license.
You can embed perl into your app.
Perl Embedding by John Quillan
C++ wrapper around Perl C API
I'm currently writing a library for embedding Perl in C++, but it's not finished yet. In any case I would recommend against using the EP library. Not only has it not been maintained for years, but is also has some severe architectural deficiencies and is rather limited in its scope. If you are interested in alpha software you can contact me about it, otherwise I'd advice you to use the raw API.
To call perl from C++ you need to use the API, as someone else mentioned; the basic tutorial is available in the perlxstut documentation.
Note that you will most probably need more than just a ".lib", because you'll need a lot of tiny modules which are located in the "lib" directory of the perl distrib: strict.pm, etc. That's a not a big deal though, I guess; the apache example you mentioned has the same constraint of delivering some default configuration files etc.
However, to distribute Perl, on Windows (I guess you're on Windows since you mentionned a .lib file), the ActiveState distribution which everyone uses might cause some licensing headache. It's not really clear to me, but it seems like you cannot redistribute ActivePerl in a commercial product. Note that, if you want to embed Perl in a C++ program, you might have to recompile it anyway, to have the same compilation flags on Perl and on your program.