can not str_cpy a global string

Posted By: CocaCola

can not str_cpy a global string - 03/31/18 07:15

hello,
if i make
Quote:

#include <acknex.h>
#include <default.c>
#include <strio.c>;

///////////////////////////////
STRING* global_str="";
function iiiii(){....
str_cpy(global_str," ");

...
}

it not work, it woks onli with local string.
why is it so?
Posted By: 3run

Re: can not str_cpy a global string - 03/31/18 09:53

Hi

It actually does work, try this:
Code:
#include <acknex.h>
#include <default.c>
#include <strio.c>

STRING* global_str = "";

function main(){
	
	str_cpy(global_str, " ");
	str_cat(global_str, "hello world");
	
	while(!key_esc){
		
		draw_text(global_str, 10, 10, COLOR_WHITE);
		
		wait(1);
		
	}
	
}

Posted By: CocaCola

Re: can not str_cpy a global string - 03/31/18 21:33

i dont konow wht was wrong, maby a space " " between file name and .mdl endname.

3run, do you know about a funktion to load files or list all filenames of a workdirektory to a string?
Posted By: Dooley

Re: can not str_cpy a global string - 03/31/18 21:37

file_open_read()
file_open_write()
file_open_append()
file_exists()

Look these up in the manual, they should get you started...
Posted By: CocaCola

Re: can not str_cpy a global string - 03/31/18 21:38

for the test with stings i have make a smal media player for my avi youtube musik files in style of youtube, but i dont know, have i to make a funktion to test all value filenames for the play list or is there a lite-c function?
Posted By: CocaCola

Re: can not str_cpy a global string - 03/31/18 21:47

can i open more than one file at once?
Posted By: Dooley

Re: can not str_cpy a global string - 03/31/18 23:25

My first advice would be to learn to love the manual. Use it all the time, eventually you will understand how to do these things. For playing media files, you need to look up "media_play" and related functions.

I don't use any media files in my games so I can't help you there...
Posted By: CocaCola

Re: can not str_cpy a global string - 04/01/18 08:49

grin that is a sweet statment.

i have no problem with play tha avi files, i can chose the files and it work.

maby i can love the online manual version more wink
Posted By: Dooley

Re: can not str_cpy a global string - 04/02/18 19:52

Okay, if you can choose files and play them, then that is a great start.

Like me, you will write a function that does everything you need it to do. THEN you will discover that Lite-c has a built in command that does the same thing laugh

I would recommend posting a new topic, since this is different from your original problem.
Posted By: CocaCola

Re: can not str_cpy a global string - 04/04/18 16:23

It was by me the same with ang_add for my space ship controll. Yes I know what you mean
© 2024 lite-C Forums