|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Tests any memory address to ensure that it is contained entirely within the program's memory space.
Points to the memory address to be tested.
Contains the number of bytes of memory to be tested.
Specifies whether the memory is both for reading and writing (TRUE) or just reading (FALSE).
// Allocate a 5 character array, which should have a valid memory address. char *array = new char; // Create a null pointer, which should be an invalid memory address. char *null = (char *)0x0; ASSERT(AfxIsValidAddress(array, 5)); ASSERT(!AfxIsValidAddress(null, 5));