On 10 Jul 2006 05:28:59 -0700, "sagar" <ch******@gmail.comwrote:
<Post takes Off Topicality to new heights - sorry too much to resist>
>how to write a C programme to read a new sms from a particular cell
came to a cell connected to that computer through a usb port
Cause you are obviously almost done, this may be already too late.
Anyway below are two programs which should almost[*] do the tasks you
want.
/* cell.c
* compile and put the program into your
* cell phone / came... something. Then run
* the program note it expects your SMS
* messages being files in a folder
* "incoming_SMS_messages". You may
* need to modify these parameters to meet
* your local settings.
*/
#include "tele3d.h"
int main (void)
{
int x=0;
time stamp1 =.0;
time stamp2 =.0;
barray *message = NULL;
t3d_measure_filepath_Rtime_CREATED_n_LAST("incomin g_SMS_messages",&stamp1);
while(1)
{
t3d_measure_filepath_Rtime_CREATED_n_LAST("incomin g_SMS_messages",&stamp2);
if(stamp1 < stamp2)
{
t3d_read_file_Rbarray_CREATED_n_LAST(NULL,&message );
x =
t3d_write_barray_Rurl_CREATE_n_OVERWRITE(message," C:\\temp\\SMS.txt");
if(x < 0)
{
x= abs(x);
t3d_write_int_Rbarray_ERROR_CODE(x,&message);
fprintf(stderr,"Error writing SMS to comp: (reason
%s)",message);
t3d_create_BEEP();
continue;
}
else
stamp1 = stamp2;
}
t3d_create_SLEEP_n_SECONDS(5);
}
return(0);
}
/* END OF cell.c */
/** BEGIN of compSMS.c
* Compile this using GCC
* and then run the program.
*/
#include "tele3d.h"
int main (void)
{
int x=0;
time stamp1 =.0;
time stamp2 =.0;
barray *message = NULL;
t3d_measure_filepath_Rtime_CREATED_n_LAST("C:\\tem p\\SMS.txt",&stamp1);
while(1)
{
t3d_measure_filepath_Rtime_CREATED_n_LAST("C:\\tem p\\SMS.txt",&stamp2);
if(stamp1 < stamp2)
{
t3d_create_BEEP();
x = t3d_write_file_2MESSAGEBOX("C:\\temp\\SMS.txt");
if(x < 0)
{
x= abs(x);
t3d_write_int_Rbarray_ERROR_CODE(x,&message);
fprintf(stderr,"could not write SMS to messagebox
(reason %s)",message);
t3d_create_BEEP();
continue;
}
else
stamp1 = stamp2;
}
t3d_create_SLEEP_n_SECONDS(5);
}
return(0);
}
/* END OF compSMS.c */
[*] almost means that you will need to write the presented t3d
functions - good luck.
If needed, t3d language documentation is available at
http://www.tele3d.com/t3d/language.pdf
Juuso Hukkanen
www.tele3d.com
(to reply by e-mail set addresses month and year to correct)
"t3d programming language" and the structure of t3d function prototype
are trademarks of Juuso Hukkanen. (Currently discussing the
transfer of those to a major charity organization).
</OT>