Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>brk</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
brk
===

Syntax
------

     #include <stdlib.h>
     
     int brk(void *ptr);

Description
-----------

This function changes the *break* for the program.  This is the first
address that, if referenced, will cause a fault to occur.  The program
asks for more memory by specifying larger values for PTR.  Normally,
this is done transparently through the `malloc' function.

Return Value
------------

zero if the break was changed, -1 if not.  ERRNO is set to the error.

Example
-------

     if (brk(old_brk+1000))
       printf("no memory\n");


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson