CLEO Help Allocating Memory

CLEO related
Status
Not open for further replies.

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
I want to make an input dialog (style 1) in which a command will be typed. How much memory do i need to allocate in order to store that command in a .ini file?
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
Every character in a string is 1 byte so you can do the string length. Most people do 255 bytes as default anyway don't think it matters unless you're wasting thousands of bytes.
C++:
0C17: 1@ = strlen 0@ // gives length of string 0@
// requires alloc however
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
Every character in a string is 1 byte so you can do the string length. Most people do 255 bytes as default anyway don't think it matters unless you're wasting thousands of bytes.
Code:
0C17: 1@ = strlen 0@ // gives length of string 0@
But you know without allocation you can't get strings which mean you can't use strlen
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
But you know without allocation you can't get strings which mean you can't use strlen
Ok well scrap that then. Could always allocate 255 and then strlen and then further adjust to save memory.
And there's this for strlen.
 
Status
Not open for further replies.
Top