Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (EternallyCurious, Quad, vicknick), 700 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
str_cut #400729
05/06/12 19:41
05/06/12 19:41
Joined: Feb 2009
Posts: 11
R
Racebert69 Offline OP
Newbie
Racebert69  Offline OP
Newbie
R

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 - ",")

Code:
#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
T
Tempelbauer Offline
Expert
Tempelbauer  Offline
Expert
T

Joined: Feb 2005
Posts: 3,687
Hessen, Germany
your method-call is wrong:

Code:
worte = str_cut (NULL , wort , "g" , anzahl );



but the prototype says:

Quote:
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 laugh

Re: str_cut [Re: Tempelbauer] #400740
05/06/12 23:29
05/06/12 23:29
Joined: Feb 2009
Posts: 11
R
Racebert69 Offline OP
Newbie
Racebert69  Offline OP
Newbie
R

Joined: Feb 2009
Posts: 11
yeah thx - after long testing I build in that error.

but the the script crashes also with:

worte = str_cut (NULL , wort , 1 , 10 );

Re: str_cut [Re: Racebert69] #400759
05/07/12 12:29
05/07/12 12:29
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
T
Tempelbauer Offline
Expert
Tempelbauer  Offline
Expert
T

Joined: Feb 2005
Posts: 3,687
Hessen, Germany
is your string long enough? if you cut 1 char from the beginning and 10 from the end, your string should contain at least 11 characters

Re: str_cut [Re: Tempelbauer] #470573
01/22/18 10:05
01/22/18 10:05
Joined: Dec 2009
Posts: 128
China
frankjiang Offline
Member
frankjiang  Offline
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!

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