Borland C++ reference

farrealloc

raw OCR

Adjusts allocated block in far heap.

Defined in header <alloc.h>

Syntax

#include <alloc.h>
void far *farrealloc(void far *oldblock,unsigned long nbytes);

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

farrealloc adjusts the size of the allocated block to nhytes, copying the contents to a new location, if necessary.

For allocating from the far heap, note that

B all available RAM can be allocated. ■ blocks larger than 64K can be allocated. ■ far pointers are used to access the allocated blocks.

A tiny model program cannot make use of farrealloc.

Return value

farrealloc returns the address of the reallocated block, which might be different than the address of the original block. If the block cannot be reallocated, farrealloc returns null.

See also

Example

#include <stdio.h>
#include <alloc.h>
int main(void)
{
   char far *fptr;
   char far *newptr;

   fptr = (char far *) farmalloc (16);
   printf("First address: %Fp\n", fptr) ;

   /* We use a second pointer, newptr, so that  in the case of farrealloc()
      returning NULL, our original pointer  is not set to NULL. */

   newptr = (char far *) farrealloc (fptr,64);
   printf("New address   : %Fp\n", newptr);
   if (newptr != NULL)
   farfree(newptr);
return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.