Write txt file in program files, not allowed in vista!

Posted By: Toon

Write txt file in program files, not allowed in vista! - 11/03/09 18:19

Code:
var save_handle;

function save_settings()
{		
  save_handle = file_open_write("resolution.txt");
	
  file_var_write(save_handle,resolution);

  file_close(save_handle);
}



We made a save system in our game based on code like this right up here. We really want to install the game in the program files folder but Vista seems to have a problem with reading and writing files like that in that folder.

It says "Empty pointer in"E1415, invalid pointer or handle in".

Anyone knows a solution to this?
Posted By: delinkx

Re: Write txt file in program files, not allowed in vista! - 11/04/09 03:26

btw, the error is E1514.

There is no error in the code, if u have defined resolution as a variable. please check that. rest of the code is fine.

And check that the folder u writing to has permissions.
Posted By: Locoweed

Re: Write txt file in program files, not allowed in vista! - 11/05/09 23:44

I don't know what your issue is, but writing .txt files in Vista does work.
Posted By: Ottawa

Re: Write txt file in program files, not allowed in vista! - 11/06/09 00:04

Hi!

Please explain

file_var_write(save_handle,resolution);

Where and what is resolution?....this might be the problem.
Posted By: Sepiantum

Re: Write txt file in program files, not allowed in vista! - 11/07/09 15:09

I'm pretty sure it works. I currently do not have windows vista because it fails. I have windows xp. Did you try to run it as Administrator? I'm pretty sure that normal users cannot write to program files. Try writing to documents instead? If writing to documents works and not program files, then it's your account limits that restricts you.

*EDIT*
For the file you are writing to, change it to: "C:\\Program Files\\resolution.txt"
I'm sure that Lite-C doesn't know where to open the file. If that doesn't work, then it's the problem I explained above. Oh, if you don't know why I have \\ instead of \, it is because strings have escape sequences. \n is newline, \t is tab, etc. And because of that, \ doesn't mean anything unless if you put a character in front of it. Which means you need \\ to have \ in the actual string.
© 2024 lite-C Forums