473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

DHTML and C communication

10
Hi All,

I am a newbie to DHTML.

Is there any way to communicate from C to DHTML and vice-versa?. Like Swig which will communicate from C to PHP and vice-versa.

Awaiting for the replies.

Regards,
Malar
Nov 25 '09 #1

✓ answered by drhowarddrfine

There isn't anything to doing this in C. In it's simplest form:
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2.  
  3. int
  4. main(void){
  5. printf("Content-type: text/html; charset=utf-8\n\n");
  6. printf("Hello, world!");
  7. }
  8.  
Compile and put in your cgi-bin file and you're all set. Of course, I didn't add any html to that but you simply put it in the printf statement:

printf("<p>Hello, World!</p>");

17 4138
Dormilich
8,658 Expert Mod 8TB
I don’t know what you need that for, but I think you would have to make an AJAX call to a script, where you can run C in.
Nov 25 '09 #2
MalarN
10
Hi Dormilich,

I am using a web server where the DHTML pages will be placed and on demand the pages will be rendered dynamically. The functionality is coded in C. I want to communicate the result from the C to the DHTML pages.

Is it possible with ajax call ???

Regards,
Malar
Nov 25 '09 #3
Dormilich
8,658 Expert Mod 8TB
@MalarN
could you explain that a little more? if it only is server to client communication, the matter could simplify a lot.
Nov 25 '09 #4
MalarN
10
Hi Dormilich,

I have to place my DHTML pages and the C code in the embedded linux. When ever a request is made from the client, C code will get the necessary details and have to give the details to the DHTML pages.

Also the details from the client i.e., from the DHTML pages have to reach the C code and necessary changes have to happen.

Regards,
Malar
Nov 25 '09 #5
drhowarddrfine
7,435 Expert 4TB
I'm not sure what you mean by dhtml pages having to reach the c code except, perhaps, you mean you need to interface some language like php or python to some c code elsewhere. Most scripting languages like those have a c interface but you'd have to look at the documentation for your language.

If, otoh, you are trying to create dynamic (dhtml) web pages using C then, yes, I do it all the time.
Nov 25 '09 #6
Dheeraj Joshi
1,123 Expert 1GB
What MalarN wants is, the Target device is some embedded device running on Wind river OS. The device functionality is written in C. Now they want to provide the web interface for that device. So they were hoping to do that using PHP. But to serve the pages PHP(Parser) need to be in that device along with some web server, to achieve this cross compiling the PHP source is necessary, So to avoid it they are thinking of achieving it using dynamic HTML....

@drhowarddrfine
Interesting.... How you do that...I want to learn.....?

Regards
Dheeraj Joshi
Nov 25 '09 #7
drhowarddrfine
7,435 Expert 4TB
Dynamic HTML means the page are created on the fly as they are being served so some programming language will be required no matter what. As far as servers go, you wouldn't need Apache but he could use something lighter like lighttpd or even lighter ones like thttpd and others.

Or avoid server software altogether and program straight to sockets.

Creating web pages using C is not significantly different than any other language. The compiled executable is placed in the bin directory of the server and it gets called like any scripted program. I've even done it in assembly before.
Nov 25 '09 #8
Frinavale
9,735 Expert Mod 8TB
Thanks Doc :)

I was thinking about a hypothetical device that would service webpages that report the status of the device (along with other self diagnostics details) and also lets users change the status of the device (and do some other basic, low-level functions)....pretty much develop a "thin-client" for the device.

I was curious to see what types of embedded HTTP servers were out there to help with the task.

Although I'm not sure if this is going to be the best approach for my system requirements...I'm going to look into your recommendations.

-Frinny
Nov 25 '09 #9
drhowarddrfine
7,435 Expert 4TB
Then you'll love this.
Nov 26 '09 #10
MalarN
10
@drhowarddrfine
Ya, I am using a light weight web server (Nginx web server).

Can you help me, by giving a step by step tutorial to create dynamic (dhtml) web page using C or a web site which deals with the same.
Nov 26 '09 #11
Frinavale
9,735 Expert Mod 8TB
Looks very impressive :) :)
Nov 26 '09 #12
drhowarddrfine
7,435 Expert 4TB
There isn't anything to doing this in C. In it's simplest form:
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2.  
  3. int
  4. main(void){
  5. printf("Content-type: text/html; charset=utf-8\n\n");
  6. printf("Hello, world!");
  7. }
  8.  
Compile and put in your cgi-bin file and you're all set. Of course, I didn't add any html to that but you simply put it in the printf statement:

printf("<p>Hello, World!</p>");
Nov 26 '09 #13
MalarN
10
Hi,

I am using Nginx webserver. I have the functionality in C. The data is displayed in the web page using php scripts through the interface swig. Now I want to replace php script. I got a suggestion to used DHTML, so that it can be easily cross compiled and put in the embedded board.

Please give me some suggestions to proceed.
Dec 3 '09 #14
Dormilich
8,658 Expert Mod 8TB
DHTML has nothing to do with server processes (thus you need HTML to begin with). unless you understand something different under DHTML than I.
Dec 3 '09 #15
DHTML? I'm confused.

If you communicate HTML (which is by its definition, a *static* document layout, from its origin SGML) with any "dynamically generating text" executable program, only then it becomes DHTML.
Dec 4 '09 #16
MalarN
10
I was able to do. Thank you.
Dec 18 '09 #17
MalarN
10
@drhowarddrfine
I was able to do. Thank you.
Dec 18 '09 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Frances Del Rio | last post by:
please, can you go to http://www.francesdelrio.com/dhtml/ when you click the name of the character the font color for all the lines of that character should change.. this is a simple DHTML...
5
by: sonic_soul | last post by:
Hello, I am finishing up creating a fairly complex page that is very rich in DHTML. In addition to updating it self every couple of seconds, various components on it support sync and async...
2
by: mr_burns | last post by:
hi there, i would like a book that will explain concepts of javascript and dhtml instead of, for example, ten tutorials on how to do specific things in js or dhtml. ideally a book thats can...
1
by: Steve | last post by:
Hi; I have heard about a few very good books on DHTML, but the most modern ones seem to have been published in 2002. Have any _significant_ changes in DHTML or the standard DOM happened since...
2
by: | last post by:
Hello All, Could some one send me information on DHTML tutorials where I can leand the differences between html and dhtml. Thanks, ...
3
by: Tim Reynolds | last post by:
I support a .Net application running on a SERVER accessing MF Db2 data. Occasionally, we have some type of connection problem that we have been unable to debug up to this point. We typically...
9
by: ninhovid | last post by:
Hi... i'm new at dhtml, and i want to use it in help windows (instead of window.open() of javascript)... i'm done it... but it works only in internet explorer.. in firefox 2 and 3 it opens the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.