Click here to Skip to main content
15,894,460 members

Comments by bijaynayak (Top 16 by date)

bijaynayak 10-Aug-17 2:53am View    
hi thanks for the suggestion, but according to my requirement ,
1:i need to transfer the strut data to multiple servers (or we can say diff nodes
) & that server understand only char.
2:memcpy is not suggestible because it work with address, from receiving end how to get the same structure data
bijaynayak 10-Aug-17 2:47am View    
Hi pwasser,
i will keep all struct members in to a : separated value after that i will
split this with strtok()which will split the above buffer.

sample code below:
struct student studt2;

snprintf(buffer,bufferSize,"%s:%d:%d:%d:%d",studt.name,studt.rollNumber,studt.dob.dd,studt.dob.mm,studt.dob.yy);
ptr = strtok(buffer,":");

while(ptr != NULL)
{
// studt2.name= strtok(buffer);
strcpy(studt2.name,strtok(buffer));
studt2.rollNumber=atoi(ptr);
ptr=strtok(NULL,":");
}
but how to store values of respective members again ?
problem is basicaly with studt2.name...
bijaynayak 9-Aug-17 1:58am View    
hi pwasser, yes need to deserialise the char [] to again struct.
bijaynayak 7-Dec-15 1:10am View    
Hi Peter,
I had already went through this option but shows "we will meet you soon"
bijaynayak 28-Nov-15 12:27pm View    
PIEBALDconsult,
I am expecting that it will not give any compilation process....