Unknown c function

I'm tranlating a old c source to c++ builder and I found some
functions with i down't know waht they nor have their source.
The functions are:

unsigned int coreleft(void)
char *dir(char *filename,int mode)
char *gcdir(char *)
LVL 1
lfrodriguesAsked:
Who is Participating?
 
AlexVirochovskyConnect With a Mentor Commented:
lfrodrigues, i guess, that my comment
helps you.
Alex
0
 
AlexVirochovskyCommented:
1.
coreleft

Syntax

#include <alloc.h>

In the tiny, small, and medium models:

unsigned coreleft(void);

In the compact, large, and huge models:

unsigned long coreleft(void);

Description

coreleft returns a measure of RAM memory not in use. It gives a different measurement value, depending on whether the memory model is of the small data group or the large data group.

Return Value

In the small data models, coreleft returns the amount of unused memory between the top of the heap and the stack. In the large data models, coreleft returns the amount of memory between the highest allocated block and the end of available memory.

Other functions not system(may be created by developer).
2.
By style dir ~ may be as:
DIR(filename)

Transfer Macros

The $DIR transfer macro expands to the directory portion of the path passed as an argument, without a trailing backslash.

Example

$DIR(D:\bc\bin\bcc.exe)

expands to:

\bc\bin
3.
 gcdir as getcurdir
getcurdir

Syntax

#include <dir.h>
int getcurdir(int drive, char *directory);

Description

Gets current directory for specified drive.
getcurdir gets the name of the current working directory for the drive indicated by drive. drive specifies a drive number (0 for default, 1 for A, and so on). directory points to an area of memory of length MAXDIR where the null-terminated directory name will be placed. The name does not contain the drive specification and does not begin with a backslash.

Return Value

getcurdir returns 0 on success or -1 in the event of error.

0
 
lfrodriguesAuthor Commented:
sorry i couldn't como here sonner,
how do i make the source for coreleft??
0
Managing Security & Risk at the Speed of Business

Gartner Research VP, Neil McDonald & AlgoSec CTO, Prof. Avishai Wool, discuss the business-driven approach to automated security policy management, its benefits and how to align security policy management with business processes to address today's security challenges.

 
AlexVirochovskyCommented:
>>source for coreleft??
What do you means? You want change standart function of C? I don't think, that it is easy.

0
 
lfrodriguesAuthor Commented:
I just want it's source. or the soure of a similiar function. Don't you know where i can find it?
0
 
AlexVirochovskyCommented:
* +++Date last modified: 05-Jul-1997 */

/*
**  MEMAVAIL.C - Report available DOS memory
**
**  public domain by Thor Johnson
*/

#include <dos.h>
long memavail(void)
{
      union REGS regs;

      /* Request impossibly large number of 16-byte paragraphs from DOS */

      regs.h.ah = 0x48;
      regs.x.bx = 0xFFFF;

      int86(0x21,&regs,&regs);

      return((long)regs.x.bx * 16L);
}

#ifdef TEST

#include <stdio.h>

main()
{
      printf("Available DOS memory = %ld bytes\n", memavail());
      return 0;
}

#endif /* TEST */
0
 
AlexVirochovskyCommented:
Previous snippet returns all availible
 memory of PC. If you want exectly core
left: free memory, you must define
number occuped memory. I don't know how make it. May be some interruption(
check  http://www.cs.cmu.edu/~ralf/files.html
http://www.ctyme.com/rbrown.htm
) or you can use heapwalk (and co) function for define size of heap.
0
 
lfrodriguesAuthor Commented:
Thanks Man, That will do the trick
:)
0
All Courses

From novice to tech pro — start learning today.