Laserlight,
Can this be used for my kind of structs too...?
Type: Posts; User: bandal27
Laserlight,
Can this be used for my kind of structs too...?
Well...
I meant to say copy the contents of the second struct to the first.
There was a hurried typo.
hi,
So far I am doing this to copy the contents(which is working just fine), each time I need the values of the "first" renewed.
n = malloc(sizeof(second));
p = malloc(sizeof(first));
...
hi,
How can I write a function to copy the contents of struct first to second ?
typedef struct copyone{ char key[32];char value[32];}copyone,copytwo;
typedef struct first{ char...
oh ok....Thank you for your response.
hi everyone,
Can I make a single function accept different pairs of structures
that will make the function process the data in similar way...?
Thank you
hi Laserlight
I understand what you are saying but I know for a fact that the rest of the functions are working fine....
Important thing is....do you see anything wrong at first glance in this...
I have made a few minor syntax errors while trying to explain the problem to you guys....please over look it :-)
typedef structn ARRAY1{
char time[ARRAY_SIZE];
char date[ARRAY_SIZE];
}ARRAY1,ARR2;
typedef struct first{
char name[10];
ARRAY1 *main;
}first;
Hi,
I cant copy the whole compiled code ...
but can you see any problem in this code.
typedef structn ARRAY1{
hi,
Here is the original struct
typedef struct{
char time[ARRAY_SIZE];
char date[ARRAY_SIZE];
}ARRAY1, 2_ARRAY;
typedef struct{
Sorry I meant to use only 1 %s...
for(i=0; i < count; i++)
{
printf("%d %s \n", i,ptr->main[count].key);
}
hello friends,
I am having a problem.
This code works just fine when I print as soon as I assign the string to
the pointer.
ptr->main = malloc(sizeof(detail)*(660)+1);
...
yep got it...its working....thank you.
Can you help me with pointing the pointer
I am not sure where to initialize the pointer.
Can you confirm if this line is correct?
strcpy(first_info.main[count].time,tokens[i]);
still getting the
"test.c", line 136: syntax error before or at: *
Yes i must have missed it when I substituted the array names...
could you please substitute 2_ARRAY as ARR2
I have changed the names of the original structs....but here is the corrected one....
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<regex.h>
#define ARRAY_SIZE 340
Here is the code I am trying to run
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<regex.h>
#define ARRAY_SIZE 340
Actually the line is in the main().
Its not in any function.
The code is too long.
CORRECTION..
this is the code having error
strcpy(first_info.main[count].time,tokens[i]);
line 115: syntax error before or at: *
I am trying to get this to work.
typedef struct{
char time[ARRAY_SIZE];
char date[ARRAY_SIZE];
}ARRAY1, 2_ARRAY;
typedef struct{
char name[10];
thank you,
Just one last question is the malloc needed here...?
oh ok...whats the syntax for assigning time through the "struct second"