CString Reference

File
XSFoundation/include/XS/Functions/CString.h
Author
Jean-David Gadina - www.xs-labs.com
Copyright
© (c) 2020 - Jean-David Gadina - www.xs-labs.com
Date
Sunday, September 27, 2020
Includes

Overview

CS string functions

Tasks

XSCStringCopy

Copies a null-terminated C string into a buffer

XS_EXPORT bool XSCStringCopy( char *buf, size_t size, const char *str, size_t count );

Discussion

This function will attempt to copy `count` bytes from `str` into `buf`, assuming there is enough room for it, including the termination character. The destination buffer will be zero-initialized whether or not the string is copied.

Parameters
  • buf
    The buffer in which to copy the string
  • size
    The size of the buffer, in bytes
  • str
    The string to copy
  • count
    The number of bytes to copy, or 0 for the whole string
Return value

True if the string was copied, otherwise false