Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - coreleft() return the amount of available dynamic memory http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 coreleft()          Return the amount of available dynamic memory
------------------------------------------------------------------------------
 Declaration
   memory.hdr

 Syntax
   func ulong coreleft extern

 Arguments
   None.

 Return
   The amount of unsued memory in bytes.

 Description
   The coreleft() function returns the amount of available dynamic memory.

 Example
   #define EXAMPLE_MEMORY
   #include example.hdr

   proc Test_coreleft
   vardef
      ptr( byte ) pMem
   enddef
   do while .t.
      ? coreleft()                     // display free memory
      pMem := malloc( 50000 )          // allocate 50 Kbytes
      if pMem == 0                     // if allocation failed
         ? "Memory exhausted"          // display message
         exit                          // leave loop
      endif
   enddo
   endproc

   proc main
   Test_coreleft()
   endproc

See Also: malloc()

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