S
As the problem was scattered, the error occurred in a different place, not where the environment was shown. The reason was to use the dynamic memory, and I don't understand why it made a mistake. To speak straight, yesterday this code called a crash. I've been commenting on the use of variables all over my function, and I've just removed it at the end.I tried to free my memory right after I was released. If I'm doing it after 100 lines (not using it) I'. It's working now. Magic, trees. ♪ ♪Total operating code: void parse_position_data(const char *arg_pos_data, position_data *pdata){
pdata->reset_dynamic();// reseting buffer
//fetching data
sscanf(arg_pos_data, "%*c%*c%*c%*c%*c%*c,%*c%*c%*c%*c%*c%*c,%*c,%*f,%*c,%*f,%*c,%*f,%*f,%*f,%*d,%*d,%*d,%*d,%*d,%*d,%d",&pdata->base_stations_quantity);
pdata->nearby = new base_station_opt[pdata->base_stations_quantity];
char day[3], month[3], year[3], hour[3], min[3], sec[3];
memset(day, '\0', 3);
memset(month, '\0', 3);
memset(year, '\0', 3);
memset(hour, '\0', 3);
memset(min, '\0', 3);
memset(sec, '\0', 3);
char *pos_data = new char[opt_buffer];
sscanf(arg_pos_data, "%c%c%c%c%c%c,%c%c%c%c%c%c,%c,%f,%c,%f,%c,%f,%f,%f,%d,%d,%d,%d,%d,%ld,%d,%d,%d,%d,%d,%d,%d,%s",
&day[0], &day[1], &month[0], &month[1], &year[0], &year[1],
&hour[0], &hour[1], &min[0], &min[1], &sec[0], &sec[1],
&pdata->positioning,
&pdata->latitude,
&pdata->mark_latit,
&pdata->longitude,
&pdata->mark_longit,
&pdata->speed,
&pdata->direction,
&pdata->altitude,
&pdata->satel_num,
&pdata->signal_intensity,
&pdata->power,
&pdata->steps_num,
&pdata->roll_num,
&pdata->terminal_state,
&pdata->base_stations_quantity,
&pdata->base_station_tower,
&pdata->mcc_country_code,
&pdata->mnc_netw_num,
&pdata->base_station_area_code,
&pdata->base_station_num,
&pdata->base_station_signal_strength,
pos_data
);
printf("pos_data:%s\n\n", pos_data);
time_t timestamp;
struct tm * timeinfo;
time(&timestamp);
timeinfo = localtime ( &timestamp );
//parsed_data.date is ddmmyy string. 120115 = 12 january 2015.
timeinfo->tm_year = atoi(year) + 100; // year from 1900
timeinfo->tm_mon = atoi(month) - 1; // month since jan (0-11)
timeinfo->tm_mday = atoi(day); // day of month (1-31)
timeinfo->tm_hour = atoi(hour);
timeinfo->tm_min = atoi(min);
timeinfo->tm_sec = atoi(sec);
pdata->timestamp = mktime(timeinfo);
for(int i = 0; i < pdata->base_stations_quantity; i++){
sscanf(pos_data, "%d,%d,%d,%s", &pdata->nearby[i].are_code, &pdata->nearby[i].number, &pdata->nearby[i].signal_strength, pos_data);
}
delete[] pos_data;
}
Z, you, if there's anything you can do, put your hands on it, because it's the right thing to do, and it's all good for me.Z,Z, you, I hope that helps anyone. (And yes - don't believe the media, think your head. People wrote the media, and they're wrong, too. ♪ ♪ )