SDDSlib
Loading...
Searching...
No Matches
str_copy.c File Reference

Implementation of the strcpy_ss function for safe string copying. More...

#include <string.h>
#include "mdb.h"

Go to the source code of this file.

Functions

char * strcpy_ss (char *dest, const char *src)
 Safely copies a string, handling memory overlap.
 

Detailed Description

Implementation of the strcpy_ss function for safe string copying.

This file contains the implementation of the strcpy_ss function, which safely copies a string from the source to the destination buffer, ensuring that overlapping memory regions are handled correctly.

License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.
Author
Y. Wang, M. Borland, R. Soliday

Definition in file str_copy.c.

Function Documentation

◆ strcpy_ss()

char * strcpy_ss ( char * dest,
const char * src )

Safely copies a string, handling memory overlap.

Copies the string pointed to by src, including the terminating null byte, to the buffer pointed to by dest. This function ensures that the copy is performed safely even if the source and destination buffers overlap.

Parameters
destPointer to the destination buffer where the string will be copied.
srcPointer to the null-terminated source string to copy.
Returns
Pointer to the destination string dest.

Definition at line 34 of file str_copy.c.

34 {
35 return (char *)memmove(dest, src, strlen(src) + 1);
36}