• C

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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
AlexVirochovskyCommented:
lfrodrigues, i guess, that my comment
helps you.
Alex
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lfrodriguesAuthor Commented:
sorry i couldn't como here sonner,
how do i make the source for coreleft??
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.