| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csutil/util.h File Reference

Miscellaneous utilities. More...

`#include <stdio.h>`
`#include "csextern.h"`
`#include "csutil/csunicode.h"`

Go to the source code of this file.

## Classes
struct | csCtoW
| Helper class to convert char* (UTF-8 encoded )to wchar_t* strings for use as function parameters. More...
struct | csWtoC
| Helper class to convert wchar_t* to char* (UTF-8 encoded) strings for use as function parameters. More...
## Functions
char * | csExpandName (const char *iName)
| Expand a filename if it contains shortcuts.
int | csFindNearestPowerOf2 (int n)
| Finds the smallest number that is a power of two and is larger or equal to n.
void | csFindReplace (char *dest, const char *src, const char *search, const char *replace, int max)
| Given `src` and `dest`, which are already allocated, copy `source` to `dest`.
bool | csGlobMatches (const char *fName, const char *fMask)
| Perform shell-like filename globbing (pattern matching).
bool | csIsPowerOf2 (int n)
| Returns true if n is a power of two.
static int | csLog2 (int n)
| Find the log2 of 32bit argument.
void | csReplaceAll (char *dest, const char *src, const char *search, const char *replace, int max)
| Given `src` and `dest`, which are already allocated, copy `source` to `dest`.
void | csSplitPath (const char *iPathName, char *oPath, size_t iPathSize, char *oName, size_t iNameSize)
| Split a pathname into separate path and name.
int | csStrCaseCmp (char const *str1, char const *str2)
| Perform case-insensitive string comparison.
int | csStrNCaseCmp (char const *str1, char const *str2, size_t n)
| Perform case-insensitive string comparison of the first `n` characters of `str1` and `str2`.
char * | csStrNew (const wchar_t *s)
| Allocate a new char [] and copy an UTF-8 version of the string into the newly allocated storage.
char * | csStrNew (const char *s)
| Allocate a new char [] and copy the string into the newly allocated storage.
wchar_t * | csStrNewW (const char *s)
| Allocate a new widechar [] and copy the string converted from UTF-8 into the newly allocated storage.
wchar_t * | csStrNewW (const wchar_t *s)
| Allocate a new widechar [] and the string into the newly allocated storage.

## Detailed Description

Miscellaneous utilities.

Definition in file util.h.