Open Lighting Architecture: include/ola/strings/Utils.h File Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Namespaces | Functions
Utils.h File Reference

## Detailed Description

Miscellaneous string functions.

Go to the source code of this file.

## Namespaces
namespace | ola
| The namespace containing all OLA symbols.

## Functions
void | ola::strings::CopyToFixedLengthBuffer (const std::string &input, char *buffer, unsigned int size)
| Copy a string to a fixed length buffer without NULL terminating.
template<size_t size>
void | ola::strings::StrNCopy (char(&output)[size], const char *input)
| A safe version of strncpy that null-terminates the output string.

## Function Documentation

## ◆ CopyToFixedLengthBuffer()

void ola::strings::CopyToFixedLengthBuffer | ( | const std::string & | input,
|  | char * | buffer,
|  | unsigned int | size )

Copy a string to a fixed length buffer without NULL terminating.

Parameters

  input | The string to copy to the buffer.
  buffer | The memory location to copy the contents of the string to.
  size | The size of the memory buffer.

Note
  The buffer may not be NULL terminated, it's not safe to use functions like strlen(), printf() etc. on the result. This is typically used in RDM code.

## ◆ StrNCopy()

template<size_t size>

void ola::strings::StrNCopy | ( | char(&) | output[size],
|  | const char * | input )
| inline

A safe version of strncpy that null-terminates the output string.

Parameters

  [out] | output | The output array
  [in] | input | The input string.