# include/string.h File Reference

Standard string operations. More...

`#include <types.h>`

Include dependency graph for string.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions
void * | memcpy (void *dest, const void *src, size_t n)
| Copy memory area.
void * | memset (void *s, int c, size_t n)
| Initialize memory area.
void * | memchr (const void *s, int c, size_t n)
| Search a memory area for a character.
int | strcmp (const char *s1, const char *s2)
| Compare the two strings s1 and s2.
size_t | strlen (const char *s)
| Calculate the length of the string s.
char * | strchr (const char *s, int c)
| Locate the character c in the string s.

## Detailed Description

Standard string operations.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file string.h.

## Function Documentation

void* memchr | ( | const void * | s,
|  | int | c,
|  | size_t | n |
| ) |  |  |

Search a memory area for a character.

Scan the memory area from s to s + n (non-inclusive) for the occurrence of c.

Parameters:

  | s | Pointer to start of memory area.
  | c | Character to look for.
  | n | Size of memory area.

Returns:
  Pointer to the matching character or NULL if c doesn't occur in the given memory area.

void* memcpy | ( | void * | dest,
|  | const void * | src,
|  | size_t | n |
| ) |  |  |

Copy memory area.

Copy n bytes from src to dest.

Parameters:

  | dest | Pointer to the destination memory area.
  | src | Pointer to the source memory area.
  | n | The number of bytes to copy.

Returns:
  The dest parameter.

Referenced by console_drv_write(), and udc_ep0_write_sync().

void* memset | ( | void * | s,
|  | int | c,
|  | size_t | n |
| ) |  |  |

Initialize memory area.

Fill the first n bytes of the memory area s with the constant byte value c.

Parameters:

  | s | Pointer to the memory area to be filled.
  | c | The byte value to use as fill value.
  | n | The number of bytes to initialize.

Returns:
  The s parameter.

Referenced by aesblk_alloc_req(), block_copy_alloc(), dummy_blkdev_init(), journal_init(), sdmmc_blkdev_init_new(), sdmmc_mcihost_init(), sdmmc_probe_init(), and usb_func_add_config().

char* strchr | ( | const char * | s,
|  | int | c |
| ) |  |  |

Locate the character c in the string s.

Parameters:

  | s | A NUL-terminated string.
  | c | The character to look for.

Returns:
  A pointer to the first occurrence of the character c in the string s or NULL if c was not found.

int strcmp | ( | const char * | s1,
|  | const char * | s2 |
| ) |  |  |

Compare the two strings s1 and s2.

Parameters:

  | s1 | A NUL-terminated string.
  | s2 | Another NUL-terminated string.

Return values:

  | <0 | s1 is less than s2.
  | 0 | s1 equals s2.
  | >0 | s1 is greater than s2.

size_t strlen | ( | const char * | s | ) |

Calculate the length of the string s.

Parameters:

  | s | A NUL-terminated string.

Returns:
  The number of characters in s before the terminating '\0' character.

Referenced by console_drv_putstr().