I would like the accomplish the same result that happens with memcpy without actually using memcpy.
Here is the code I would like to change away from memcpy.
memcpy((char *) &(serv_addr.sin_addr.s_addr),
(char *)(server->h_addr), server->h_length);
Is there a way to do this?
You can recode
memcpyeasily with a for loop. If the compiler provides intrinsics, you can use them. Gcc has__builtin_memcpy. But the most important thing is that you are probably wrong in doing so,memcpyis used everywhere and can’t be buggy.