Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


malloc help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Fri Jan 02, 2009 3:22 am    Post subject: malloc help Reply with quote

I'm just going to get right to the point.

I need to malloc an int enough space to hold 1000 digits.
I'm not sure how to allocate enough bytes equivalent to 1000(+1) digits.

Can anybody help me out here? Smile

_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Fri Jan 02, 2009 4:02 am    Post subject: Reply with quote

Code:
malloc(  ceil((floor(log(pow(10, 1000))/log(2)) + 1) / 4) )


The math is right, good luck finding a data type to hold pow(10, 1000).
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Fri Jan 02, 2009 9:21 pm    Post subject: Reply with quote

Flyte I don't understand. Because wouldn't all that add up to just a number? when it actual wants the size in bytes.
_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Fri Jan 02, 2009 10:04 pm    Post subject: Reply with quote

Overload wrote:
Flyte I don't understand. Because wouldn't all that add up to just a number? when it actual wants the size in bytes.


Are you implying that a size is not a number?

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Sat Jan 03, 2009 2:44 am    Post subject: Reply with quote

samuri25404 wrote:
Overload wrote:
Flyte I don't understand. Because wouldn't all that add up to just a number? when it actual wants the size in bytes.


Are you implying that a size is not a number?


So then

Code:
int result = (int)malloc(  ceil((floor(log(pow(10, 1000))/log(2)) + 1) / 4) )


should work? I really am getting confused. lol

All i need is to make a variable able to hold 1000 digits. I know one way of doing this is using malloc. But i don't know exactly how.

_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sat Jan 03, 2009 3:33 am    Post subject: Reply with quote

it returns a pointer to your big ass block of memory.

go nuts there.
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Sat Jan 03, 2009 4:39 am    Post subject: Reply with quote

Mmkay thanks. I'll try it out and see what happens.
_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites