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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (Ayumi, Akow, monk12, AndrewAMD), 1,398 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to passing arguments to main ? #438477
03/15/14 12:57
03/15/14 12:57
Joined: Mar 2014
Posts: 33
Germany: Sachsen
N
Nicros Offline OP
Newbie
Nicros  Offline OP
Newbie
N

Joined: Mar 2014
Posts: 33
Germany: Sachsen
Hello,
how can I use start parameters ?
In C++ I would use: 'int main(int argc,char* argv[])'
and in C: 'int main(int argc,char** argv)'
but both dont works in Lite-C.

Thanks for your help.

Re: How to passing arguments to main ? [Re: Nicros] #438478
03/15/14 13:20
03/15/14 13:20
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You can read them out of the command_str variable: http://www.conitec.net/beta/command_str.htm


Always learn from history, to be sure you make the same mistakes again...
Re: How to passing arguments to main ? [Re: Uhrwerk] #438482
03/15/14 14:39
03/15/14 14:39
Joined: Mar 2014
Posts: 33
Germany: Sachsen
N
Nicros Offline OP
Newbie
Nicros  Offline OP
Newbie
N

Joined: Mar 2014
Posts: 33
Germany: Sachsen
Thank you very much ... I will test this laugh

Edit:
Ok, I have tested it and it works smile
Now I have another problem. I get the (parameters)string "34 1 2 2 1 5 17 8 9" <- thats right.
But I want to broke down this string into the integers or substrings. If there are substring I will convert them with "str_to_int". How can I divide this string ?

Last edited by Nicros; 03/15/14 17:37.
Re: How to passing arguments to main ? [Re: Nicros] #438497
03/15/14 22:21
03/15/14 22:21
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Have a look here. You can save your string in a notepad doc and divide it with commas using string manipulation

http://www.conitec.net/beta/astr-intro.htm

EDIT: and you also need file manipulation

Last edited by DevoN; 03/15/14 22:23.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: How to passing arguments to main ? [Re: DLively] #438509
03/16/14 09:10
03/16/14 09:10
Joined: Jun 2013
Posts: 108
Alberta, Canada
C
CanadianDavid Offline
Member
CanadianDavid  Offline
Member
C

Joined: Jun 2013
Posts: 108
Alberta, Canada
More specifically for the file method, take a look at:
file_find and
file_str_read

Through only the basic string functions in Gamestudio, assuming your set format for the parameter, you can iterate through each character in the string and place the non-whitespaces into an array of integers.

Otherwise, there are many C/C++ threads online related to basic string manipulation. In your case, you can search for something like "string to array of ints" in C.

Re: How to passing arguments to main ? [Re: CanadianDavid] #438571
03/17/14 18:24
03/17/14 18:24
Joined: Mar 2014
Posts: 33
Germany: Sachsen
N
Nicros Offline OP
Newbie
Nicros  Offline OP
Newbie
N

Joined: Mar 2014
Posts: 33
Germany: Sachsen
Sorry, that I donīt wrote that earlier but i had no time.
Your posts were very helpful.
Iīve solved the problem:

Code:
[...]
start_index = pos;
while ((command_str.chars)[pos]!=' ')
	pos++;
diff = pos - start_index;
str_get_chars(strTemp,command,pos,diff);
number = str_to_int(strTemp);
pos++;
[...]



Code:
void str_get_chars(STRING* str1,STRING* str2,int start_num,int count)
{
str_cpy(str1, str2);
str_clip(str1, start_num-1);
(str1.chars)[count] = 0;
}



@CanadianDavid:
Im good in C/C++ but I think Lite-C is is a lit bit complicated. (probably because I have learned C++ first)
Quote:
Otherwise, there are many C/C++ threads online related to basic string manipulation. In your case, you can search for something like "string to array of ints" in C.

Can I program with C/C++ in with connection the Acknex Engine?

Thanks. Paul

Re: How to passing arguments to main ? [Re: Nicros] #438572
03/17/14 18:27
03/17/14 18:27
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
yes, see in manual "engine SDK". or "plugin SDK" to make dll-s for lite-C in C++.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: How to passing arguments to main ? [Re: Nicros] #438573
03/17/14 18:30
03/17/14 18:30
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Yes you can. Please note that Lite-C is a subset of c. At least that's the marketing claim.


Always learn from history, to be sure you make the same mistakes again...

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