|
str_cut
#400729
05/06/12 19:41
05/06/12 19:41
|
Joined: Feb 2009
Posts: 11
Racebert69
OP
Newbie
|
OP
Newbie
Joined: Feb 2009
Posts: 11
|
can not convert 'ARRAY' to 'FIXED' whats wrong? (Sorry for too much code - I am testing for hours to read word by word with delimiters - ",")
#include <acknex.h>
#include <default.c>
#include <strio.c>
STRING* wort;
wort = "xx";
// var woerter;
// STRING* thisword;
// thisword = "xxxxxx";
STRING* zahl;
var anzahl;
anzahl = 0 ;
function main ()
{
// STRING* wort;
// wort = "xx";
STRING* thisword;
thisword = "xxxxxx";
var woerter;
STRING* ups;
// START - Textdatei laden - Inhalt zum Lernprogramm
//var zahl;
woerter = file_open_read("test2.txt");
// printf(woerter);
// ENDE - Textdatei laden - Inhalt zum Lernprogramm
//file_str_readtow(woerter, thisword);
file_str_readtow(woerter , thisword , "" , 5000);
printf(thisword);
anzahl = str_stri ( thisword , "," );
printf(anzahl);
wort = thisword;
STRING* worte;
worte = str_cut (NULL , wort , "g" , anzahl );
printf(wort);
printf(zahl);
str_clip(thisword , anzahl + 1 );
printf(thisword);
// thisword = " - ";
// file_str_readtow(woerter , thisword , "." , 20);
// printf(thisword);
// thisword = " - ";
// file_str_readtow(woerter , thisword , "." , 20);
// printf(thisword);
// thisword = " - ";
// file_str_readtow(woerter , thisword , "." , 20);
wort = thisword;
printf(thisword);
// file_chr_read(woerter, thisword);
// printf(thisword);
file_close(woerter);
}
Last edited by JustSid; 05/07/12 01:31.
|
|
|
Re: str_cut
[Re: Racebert69]
#400737
05/06/12 22:58
05/06/12 22:58
|
Joined: Feb 2005
Posts: 3,687 Hessen, Germany
Tempelbauer
Expert
|
Expert
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
|
your method-call is wrong:
worte = str_cut (NULL , wort , "g" , anzahl );
but the prototype says: str_cut(STRING* to, char* from, var start, var end) the 3rd parameter has to be a var (the startindex) and not a string! see http://www.conitec.net/beta/strio_c.htm...and welcome to the forums
|
|
|
Re: str_cut
[Re: Tempelbauer]
#470573
01/22/18 10:05
01/22/18 10:05
|
Joined: Dec 2009
Posts: 128 China
frankjiang
Member
|
Member
Joined: Dec 2009
Posts: 128
China
|
STRING* s = str_create(""); str_cpy(s,"abcdefg"); //1~3 int _s = 1; int _e = 3; str_clip(s,_s); str_trunc(s,_e); printf("%s",s->chars);
development 3d game is interesting!
|
|
|
|