Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,534 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
String lenght changed for some reason #258281
03/29/09 12:51
03/29/09 12:51
Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Shinobi Offline OP
User
Shinobi  Offline OP
User

Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Hi everyone ..

I made an application with Databases ... in old wdl
now i am rewriting it in lite-c.

i am using some strings for Names , Adresses and more. On a serch button you can list some names and adresses and on a other button you can edit them.

lets say the String was defined with
STRING* temp_str="#40";

if i push the "add new name" button and clear the String , everything works fine , i can use 40 chars while inkey. but if i just want to edit the string and dont clear it , i just can use only the same string lenght as the string currently has.
Cursor is blinking at the end of the string (thats ok) but it dont adds more characters if i type.

in my old script i was still able to fill it with 40 chars and now i cant. The limit is not 40 anymore but the lenght of the current string.

There are some ways to avoid that problem with adding empty strings but is there not a easier way ?


I am using the newest A7 Pro.
the old code was in A7 as well but in wdl and with an older A7 version.


Thanks for help.

Re: String lenght changed for some reason [Re: Shinobi] #258285
03/29/09 13:49
03/29/09 13:49
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
str_cpy changes the length of the string. to make it longer you can add spaces via str_cat.


3333333333
Re: String lenght changed for some reason [Re: Quad] #258317
03/29/09 17:31
03/29/09 17:31
Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Shinobi Offline OP
User
Shinobi  Offline OP
User

Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Originally Posted By: Quadraxas
str_cpy changes the length of the string. to make it longer you can add spaces via str_cat.


Yes i mentioned this in my first post
Quote:

There are some ways to avoid that problem with adding empty strings but is there not a easier way ?


I want to avoid that because i dont want to save so many empty string next to the main string.
If you save this to a file it also saves the empty strings.

Yes i know i can str_trunc the empty strings but maybe there is a simple way to have it all like in the older versions.

currently i made it like i mentioned it aboth but ... wyh should i use many commands for such a simple task ?

Re: String lenght changed for some reason [Re: Shinobi] #258359
03/30/09 00:21
03/30/09 00:21
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
I think a string created by str_create maintains its length, but I can't be sure. Worth a try perhaps.


Click and join the 3dgs irc community!
Room: #3dgs
Re: String lenght changed for some reason [Re: Joozey] #258370
03/30/09 03:18
03/30/09 03:18
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I THINK Joozey may be kindof right.
Try using just STRING* temp_str=""; to define the string, I think that makes it variable length.

Otherwise, try making it STRING* temp_str; and put a temp_str=str_create(""); early in main.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: String lenght changed for some reason [Re: EvilSOB] #258389
03/30/09 09:45
03/30/09 09:45
Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Shinobi Offline OP
User
Shinobi  Offline OP
User

Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
The length of a string can be maintained with STRING* temp_str="#20" already (20 empty spaces) STRING* temp_str="" creates an String with 0 chars lenght.
But with str_cat you can always add new strings to it no matter what its lenght is defined (not in older versions) . My Problem was if i want to edit a string that was read from a file into a String and if i use inkey on that strting , ther cursor is on the end of that string and normaly you can add more characters to it (depends on the lenght that was defined for it but this goes not in lite-c anymore. The String from file_str_read has only the lenght of that string and not more.

I solved that problem like i mentioned it in my first post , but i thought there is a easier way for it.

Thank you guys for helping anyway.

Last edited by Shinobi; 03/30/09 09:47.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1