Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Dynamic Memory (http://www.chiefdelphi.com/forums/showthread.php?t=79080)

Iconē 25-11-2009 13:26

Dynamic Memory
 
Hello,
is it possible to allocate dynamically memory using the intelitek easy c? While programming C in windows you use malloc and free, but those are declared in the standart windows header (stdlib.h), so they wont work. Are there any similar commands/functions in easy c ?

And my second Question. Is there in easy c a function like GetTickCount in windows? Its a function which returns the milliseconds since the PC was started.

edit: Sry i've post it in the wrong forum, maybe a moderator could change this thank you.

Thank you for answering!
Greets Iconē

slavik262 20-12-2009 21:12

Re: Dynamic Memory
 
First of all, stdlib.h is part of the C Standard Library, and should exist on all C platforms. It has nothing to do with Windows. I remember something about Easy C not having implementations for dynamic memory management due to the very small scale of platforms they target.

To answer your second question, there's a header called time.h (or ctime if you're compiling in C++). In it there's a function called clock() which returns a value of type clock_t for how long the program has been running. To convert this into seconds, there is also a definition in clock.h called CLOCKS_PER_SEC which evaluates to the number of clock_t's per second. On the Windows platforms I've compiled on so far, CLOCKS_PER_SEC is 1000, meaning each clock_t value is a milisecond.

Feel free to PM me if I can help you in any other way, and welcome to Chief Delphi.

Kingofl337 27-12-2009 08:00

Re: Dynamic Memory
 
You can include studio.h in easyC I'm not sure if malloc is in it.

If you look om API.h there are some undocumented timer / clock functions. Otherwise you could just start a timer. See the help file for use of timers.


All times are GMT -5. The time now is 01:11.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi