[Help] Save_dir

Posted By: DLively

[Help] Save_dir - 07/09/14 03:43

Code:
str_cpy(save_dir,"C:\\ProgramData\\DLively\\Subfolder\\save_dir")

filehandle = file_open_write ("%SAVE_DIR%\\scores.txt");
if(filehandle == 1){
		
	file_str_write(filehandle,end_input_name_str_i);
	file_str_write(filehandle,",");
	file_str_write(filehandle,end_name_1_str_i);
	file_str_write(filehandle,",");
	file_str_write(filehandle,end_name_2_str_i);
	file_str_write(filehandle,",");
	file_str_write(filehandle,end_name_3_str_i);
	file_str_write(filehandle,",");
		
	file_str_write(filehandle,input_name_str_i);
	file_str_write(filehandle,",");
	file_str_write(filehandle,name_1_str_i);
	file_str_write(filehandle,",");
	file_str_write(filehandle,name_2_str_i);
	file_str_write(filehandle,",");
	file_str_write(filehandle,name_3_str_i);
		
	file_close (filehandle); 
}
else beep();



This worked once and created the file in this directory - Then I deleted it to see if it would do it again - and no. not only that, but nothing was inputted inside.
Posted By: DLively

Re: [Help] Save_dir - 07/09/14 15:32

Okay,this crates the scores.txt, but does not fill in the scores.txt with the required fields:

filehandle = file_open_write ("C:\\ProgramData\\DLively\\Subfolder\\save_dir\\scores.txt");
if(filehandle == 1){

file_str_write(filehandle,end_input_name_str_i);
file_str_write(filehandle,",");
Posted By: txesmi

Re: [Help] Save_dir - 07/09/14 15:44

HI,
the filehandle variable value will probably change each run and it will probably never be equal to one.

Code:
if ( filehandle != 0 )
{...



Salud!
Posted By: DLively

Re: [Help] Save_dir - 07/09/14 18:41

Ah there we go laugh

That was the issue, Thank you much txesmi
Posted By: Dooley

Re: [Help] Save_dir - 02/19/19 19:03

I can't seem to get my game to create a folder. Does this script create a folder, or just create a file into an existing folder?
© 2024 lite-C Forums