|
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
Nicros
OP
Newbie
|
OP
Newbie
Joined: Mar 2014
Posts: 33
Germany: Sachsen
|
Thank you very much ... I will test this Edit: Ok, I have tested it and it works 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: DLively]
#438509
03/16/14 09:10
03/16/14 09:10
|
Joined: Jun 2013
Posts: 108 Alberta, Canada
CanadianDavid
Member
|
Member
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
Nicros
OP
Newbie
|
OP
Newbie
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:
[...]
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++;
[...]
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) 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]
#438573
03/17/14 18:30
03/17/14 18:30
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
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...
|
|
|
|