3.2.23. memclr

Clears memory contents in a specified range.

Syntax

char *memclr (str1, count)
char *str1;
int count;

where:

str1

A character pointer to the memory location of the first character byte in a string of characters that is replaced by the NUL character.

count

A variable of integer type, used to specify the number of consecutive bytes of memory in a character string that are to be replaced by the NUL character.

Description

This macro replaces the specified number of characters in str1 with the NUL character '\0' starting at the beginning of str1. If count is less than the length of str1, the macro returns a pointer that points to the address of the character following the area that is cleared.

Return value

char *

A pointer to the first character byte after the string of characters overwritten with the NUL character. This enables continuation of the writing process with perfect alignment of bytes for file erasure.

Rules

None

Example

This example shows how to use memclr:

define /R void memoryClr()
{
  char buff[37];
  char *posn;
  strcpy(buff,"1234567890abcdefghijklmnopqrstuvwxyz");
  posn = memclr(buff,20);
  $printf "%s\n",posn$;
}
.

See Also

Copyright © 2002-2009 ARM Limited. All rights reserved.ARM DUI 0175K
Non-Confidential