Hi all,
I tried to write a file to the root-dir of C: on my laptop, which has Vista installed, using this code (original filename$ = "C:\Test.dat"):
The code create a bank, fills it with values going from 0 to 255 and then writes the entire bank to a file.
When this is done, some bytes are read from the file (if it was created in the first place) and printed to the screen.
First I tried to write to C:\Test.dat, but this generated the error "Could not write to file" (as set within the code).
Then I modified the Security settings of the entire C-drive so that my main user could write to the disk and then it worked.
But now I have another problem.
As most games' default install-dir is C:\Program Files, I tried writing to this file: C:\Program Files\Test.dat.
It works perfectly, because Blitz writes the file (doesn't return a filehandle of 0) and it can read it's contents as it should.
But when opening the folder, the file is nowhere to be seen (I've set hidden files to display as well).
Even when doing a dir /A from within the command prompt (Start -> Execute -> cmd), the file doesn't seem to exist.
When I write the file to D:\Test.dat, the file shows up and I can open it in Notepad.
But when written to C:\Program Files, Notepad cannot load it, windows doesn't show it, nothing works to open the file, except Blitz itself.
When opening Notepad and opening the file, I go to C:\Program files and type the filename myself (as it doesn't show up in the file-list) and notepad gives me the error that the file doesn't exist.
Why can Blitz create it, and more stupidly, read it when it doesn't exist?
Can someone explain this to me?
I tried to write a file to the root-dir of C: on my laptop, which has Vista installed, using this code (original filename$ = "C:\Test.dat"):
filename$ = "C:\Program Files\Test.dat" bnk = CreateBank(256) For i = 0 To 255 PokeByte bnk, i, i Next file = WriteFile(filename$) If file <> 0 Then WriteBytes bnk, file, 0, 256 Else Print "Could not write file" EndIf CloseFile file If file <> 0 Then bnk2 = CreateBank(10) file2 = ReadFile(filename$) ReadBytes bnk2, file2, 0, 10 For i = 0 To 9 Print PeekByte(bnk2, i) Next EndIf CloseFile file2 WaitKey() End
The code create a bank, fills it with values going from 0 to 255 and then writes the entire bank to a file.
When this is done, some bytes are read from the file (if it was created in the first place) and printed to the screen.
First I tried to write to C:\Test.dat, but this generated the error "Could not write to file" (as set within the code).
Then I modified the Security settings of the entire C-drive so that my main user could write to the disk and then it worked.
But now I have another problem.
As most games' default install-dir is C:\Program Files, I tried writing to this file: C:\Program Files\Test.dat.
It works perfectly, because Blitz writes the file (doesn't return a filehandle of 0) and it can read it's contents as it should.
But when opening the folder, the file is nowhere to be seen (I've set hidden files to display as well).
Even when doing a dir /A from within the command prompt (Start -> Execute -> cmd), the file doesn't seem to exist.
When I write the file to D:\Test.dat, the file shows up and I can open it in Notepad.
But when written to C:\Program Files, Notepad cannot load it, windows doesn't show it, nothing works to open the file, except Blitz itself.
When opening Notepad and opening the file, I go to C:\Program files and type the filename myself (as it doesn't show up in the file-list) and notepad gives me the error that the file doesn't exist.
Why can Blitz create it, and more stupidly, read it when it doesn't exist?
Can someone explain this to me?