a.bharthan
BAN USER- 0of 0 votes
Answerssuppose a structure :
struct itemchar name[15]; int price; long ID; char type[8];
;
- a.bharthan in United States
if there is a server running on little endian 64bit machine and a client running on big endian 32bit machine how will client send the structure to server so that the problem of portability, endianness, and alignment does not arise?
client :
sendto(sd,(void *)&myitem, sizeof(item), 0, (struct sockaddr *) &server_addr, sizeof(server_addr));
server:
recvfrom();| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer C
sending in network byte order and receiving in host byte order i.e
htons() and ntohs will take care of endinness ?
what if it had been (struct item*) instead of void*
- a.bharthan September 16, 2012We can copy first array in "result" array, and insert elements of second array only if they are not in the "result" array.
- a.bharthan October 05, 2011HERE IS CODE IN C
int main() {
char str[20] ="hello,world";
int i=0;
for(i=0;i<strlen(str);i++){
if (str[i]>=65 && str[i]<=92){
str[i]=str[i] + 32;
}
}
printf("%s",str);
return 0;
}
thanks
- a.bharthan September 16, 2012