Link to home
Start Free TrialLog in
Avatar of lfrodrigues
lfrodrigues

asked on

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 *)
Avatar of AlexVirochovsky
AlexVirochovsky

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.

ASKER CERTIFIED SOLUTION
Avatar of AlexVirochovsky
AlexVirochovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lfrodrigues

ASKER

sorry i couldn't como here sonner,
how do i make the source for coreleft??
>>source for coreleft??
What do you means? You want change standart function of C? I don't think, that it is easy.

I just want it's source. or the soure of a similiar function. Don't you know where i can find it?
* +++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 */
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.
Thanks Man, That will do the trick
:)