when to use strncpy or memmove
        Posted  
        
            by robUK
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by robUK
        
        
        
        Published on 2010-05-21T19:14:20Z
        Indexed on 
            2010/05/21
            19:20 UTC
        
        
        Read the original article
        Hit count: 324
        
c
Hello,
gcc 4.4.4 c89
I have always used strncpy to copy strings. I have never really used memmove or memcpy very much. However, I am just wondering when would you decide whether to use strncpy, memmove, or memcpy?
The code I am writing is for a client/server application. In the documentation they use bcopy. However, could I do the same with the others?
bcopy((char*)server->h_addr,
      (char*)&serv_addr.sin_addr.s_addr,
      server->h_length);
Many thanks,
© Stack Overflow or respective owner