printf() from C to output in html

I need to string my data to output it out in html. So I need help how can i code to allow my program to print data to a .txt file . If there no way, can anyone suggest me with other ways =) thx

You want to show a variable (array of Char called string) in a web browser?

For display it in zhtml I use a editbox.

First you have to make you variable a web variable;
In C code
char email0[50];
#web email0 groups=all(rw)

In ZHTML code

I hope this will help you.

If not, mail more information.

Hey thx for ur reply. I have waited someone to reply me for many days. Ok I am doing a somehow a buglar alarm system sohow if some one trigger my sensor the time will be taken down . I want the time to be keep like a log book. not just display variable but can keep variable is it possible??

I do not know how much data you want to store.

In my project I use;


XXX=the space in bytes you will use

it is also possible to store a struct.

Hmm… with this function I able to store and read my time?? how can i display in the zhtml with this function. And anyway to clear the bytes?

If I am right you want to do two thinks.

  1. log data (when you turnoff the device you do not want to loss data)

  2. show data in a web browsser.

With writeUserBlock(); you could store data in flash memory. When you will turnoff the device, data will be saved. When you start your device you could read the data back out of the Userblock by using readUserBlock();

Use readUserBlock(); when you start your device.
Use writeUserBlock(); when you sensor deteced some one.

How many bytes you are using depents on the number of data you want to store. In exaple when you want to store an array of 10 interger, you have to set writeUserBlock(0,&time,20). 20 because a interger uses 2 bytes.

Now you have logged and store your data, you want to show it in your web browsser.

After you declare your struct of variable make it a webvariable. The way you do that is; #use time group=all(rw) and in ZHTM you could add the line I wrote before.

Maybe it is a good idea when you need more info to send you .C code.

Hmm… but somehow i could not display the string onto the zhtml. but end up is being shown on the web browser.

I think the reason why it is not working is that;

We made a Char email0[50]. So in the ZHTML you have also put that name there. But in ZHTML we call “alarm.email0”

alarm.email0 = the name of the variable you want to see in ZHTML.

In my program I use a struct named alarm and in there were called email0 till email4. That is the reason why there was standing alarm.email0. I forget to delete alarm.

I hope it will work now, also store the data in flash memory.

hey, I tried the way U have posted on the thread. Somehow I still cannot get the result. How can i allow writeUserBlock(); be written onto ZHTML. Saving data in the UserBlock(); I have no problem with it. Now is the displaying. Because even i change the char alarm.email0[50]; Somehow my web browser still showing . Pls help T.T…