• 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 *)
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.



#include <alloc.h>

In the tiny, small, and medium models:

unsigned coreleft(void);

In the compact, large, and huge models:

unsigned long coreleft(void);


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).
By style dir ~ may be as:

Transfer Macros

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



expands to:

 gcdir as getcurdir


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


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.

lfrodrigues, i guess, that my comment
helps you.

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??
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!

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

lfrodriguesAuthor Commented:
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;


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

#ifdef TEST

#include <stdio.h>

      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
) or you can use heapwalk (and co) function for define size of heap.
lfrodriguesAuthor Commented:
Thanks Man, That will do the trick
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

From novice to tech pro — start learning today.