file_open_...

Posted By: Nicotin

file_open_... - 08/17/09 22:27

Ok, I couldn't find any other topic aout this problem and I begin to start that is is just such a dump failure from me again. Ok now this code:

Code:
str_cpy(path_str,"%EXE_DIR%\\Savegames\\");
	str_cat(path_str,"savegame.txt");
	filehandle_n = file_open_read(path_str);
	if(filehandle_n != 0)
	{
         do_something();
        }
	else
	{
		printf("Error!");
	}



I just get my Error message. But the folder and file exists!

I'm sure because

Code:
str_cpy(save_dir,"Savegames");
	str_cpy(path_str,"%SAVE_DIR%\\");
	str_cat(path_str,"savegame.txt");
	filehandle_n = file_open_read(path_str);
	if(filehandle_n != 0)
	{
         do_something();
        }
	else
	{
		printf("Error!");
	}


Works, I mean it is a good work-around but I don't want to have to switch the save_di for every file I load.

Version is 7.80
Posted By: EvilSOB

Re: file_open_... - 08/17/09 22:33

PLEASE choose a different name for your string "path".
"path" is a pre-defined system variable in c-script, so you are using it in
an unnatural way, and this MAY be causing the problem.
Posted By: Nicotin

Re: file_open_... - 08/17/09 22:36

Yeah sorry. Changed it but it still doesn't work. It doesn't work either if I just type "file_open_read("%EXE_DIR%\\Savegames\\savegame.txt");"
Posted By: EvilSOB

Re: file_open_... - 08/17/09 23:13

Try it with just
file_open_read("Savegames\\savegame.txt");
Posted By: Nicotin

Re: file_open_... - 08/17/09 23:15

Ok this just worked. And I was sure that I already tryed it. Ok thank you hehe
© 2024 lite-C Forums