Posted By: Toon
function to save string to file - 06/20/08 15:02
I've written a function to save a certain string to a file but it says that when it tries to write the string the string is an invalid pointer
here is the code i use
here is the code i use
Code:
string temp_save_str1[100]; string temp_save_str2[100]; var_nsave save_handle; function save_str(string_,dir_,number_) { str_cpy(temp_save_str1,dir_); str_cat(temp_save_str1,"\\"); str_cat(temp_save_str1,"\\"); if(number_ < 10) { str_cat(temp_save_str1,"0"); } str_for_num(temp_save_str2,number_); str_cat(temp_save_str1,temp_save_str2); str_cat(temp_save_str1,".txt"); wait(1); str_cpy(temp_save_str2,string_); sleep(1); save_handle = file_open_write(temp_save_str1); file_str_write(save_handle,temp_save_str2); //file_close(save_handle); } function test() { save_str("save this data in text file","gamedata",1); } on_z = test();