Sat 05 Feb 2011 08:47:49 AM UTC, original submission:
code
-----
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <gnokii.h>
#define CONFIG_FILE NULL
struct gn_statemachine *state;
void terminate(void)
{
gn_lib_phone_close(state);
gn_lib_phoneprofile_free(&state);
gn_lib_library_free();
}
void init(void)
{
gn_error error;
atexit(init);
if((error = gn_lib_phoneprofile_load(CONFIG_FILE,&state)) != GN_ERR_NONE)
{
fprintf(stderr,"%s\n",gn_error_print(error));
exit(2);
}
}
int main()
{
gn_data data;
gn_error error;
gn_phone *phone = &state->driver.phone;
//handle output var
gn_sms_folder folder;
gn_sms_folder_list folder_list;
gn_sms message;
char *memory_type_string = "SM";
char *message_text;
//set memory type
//gn_str2memory_type("SM") == GN_MT_XX ? printf("memory SM eror") : "";
//get sms
printf("Getting Message #%d from %s",(int)1,memory_type_string);
init();
memset(&message,0,sizeof(gn_sms));
gn_data_clear(&data);
data.sms = &message;
message.memory_type = gn_str2memory_type(memory_type_string);
message.number = 1;
gn_error e;
if(e = gn_sm_functions(GN_OP_GetSMS, &data, state) != GN_ERR_NONE)
{
fprintf(stdout,"%s\n",message.user_data[0].u.text);
}
return 0;
}
-----
hi folks,
here im gonna tryin to fetch some sms from my phone simcard, and after compiled, then run, but suddenly my ubuntu get crashed at all, what parameter that i had forgotten to be input ? is there no notification from this api when the parameter is insufficient ? e.g : gtk, when i forgot insert gtk_init, they'll notice me somehow in output error.
look forward for y'all response ;)
|