Hi,
I cant copy the whole compiled code ...
but can you see any problem in this code.
Code:
typedef structn ARRAY1{
char time[ARRAY_SIZE];
char date[ARRAY_SIZE];
}ARRAY1,ARR2;
typedef struct first{
char name[10];
ARRAY1 *main;
}first;
typedef struct second{
char db[10];
2_ARRAY *other;
}second;
in main{
struct ARRAY1 *str_ptr;
struct ARR2 *new_ptr;
str_ptr = &ARRAY1_info;
new_ptr = &ARR2_info;
struct first *ptr;
struct second *new;
while (fgets(line,100,data_txt)!=NULL)
{
data_txt = fopen("data.txt","r");
trim(line);
strcpy(first_info.name,"ccmlmd");
if ((strlen(line) > 1)&&(read!=0)){
lcount++;
tokens = split(line, delim);
for(i = 0; tokens[i] != NULL; i++) {
if (i==0){
if (tokens[i]!=NULL){
ptr->main = malloc(sizeof(detail)*(660)+1);
strcpy(ptr->main[count].key,token[i]);
printf("key key %d %s ",count, ptr->main[count].key);
}
}
}
for(i = 0; tokens[i] != NULL; i++)
free(tokens[i]);
free(tokens);
count++;
lcount++;
}
// This doesnt work
for(i=0; i < count; i++) {
printf("%d %s %s", i,ptr->main[i].time, ptr->main[i].date);
}
I am particularly not able to print here.
Code:
// This doesnt work
for(i=0; i < count; i++) {
printf("%d %s %s", i,ptr->main[i].time, ptr->main[i].date);
}
If you can see anything wrong in my the last part of the code ....let me know