Recent

Author Topic: I can't safe a text file in Windows 10?[SOLVED by Jamie] Many thanks...  (Read 3756 times)

Robert W.B.

  • Sr. Member
  • ****
  • Posts: 328
  • Love my Wife, My Kids and Lazarus/Freepascal.
Hello Lazarus friends. I have made a program in Lazarus and made in Windows 10.
I load a created text file MyFile.txt and then I try to save  data in that file but,
when I want to append or overwrite the file, it will be access denied!

However, if I save the file in a different name that does not exist, it is fine to save the file with the updated data.
Questions?
1.Do we no longer own rights to our own text files in Windows 10 anymore?
 My program is in documents, so there's not the problem.
2.Does anyone have a solution to this Windows 10 Problem?
3.Could it be a Lazarus bug?
It also doesn't work if I remove read-only on my application folder or run as an administrator!

Tought's?

Best regards
Robert
« Last Edit: August 19, 2021, 02:45:10 am by Robert William Blennerhed »
Rob

RayoGlauco

  • Full Member
  • ***
  • Posts: 179
  • Beers: 1567
Re: I can't safe a text file in Windows 10?
« Reply #1 on: August 19, 2021, 12:36:03 am »
Not a clue. I think we need to see your code.
To err is human, but to really mess things up, you need a computer.

Robert W.B.

  • Sr. Member
  • ****
  • Posts: 328
  • Love my Wife, My Kids and Lazarus/Freepascal.
Re: I can't safe a text file in Windows 10? [SOLVED]
« Reply #2 on: August 19, 2021, 02:44:20 am »
Thanks Jamie. You were right. How could I possible forgot one CloseFile in the beginning?
Have Merci on me. I programmed in Python a project, a Java project and then a C++ console project. Then back to Lazarus and my favorite Pascal, so, that might be the reason for not see the error!

I tested my program made with Lazarus in Ubuntu. It works like a charm without the CloseFile in the beginning!!!


1.No Windows 10 permission issue?
2. No Lazarus/Freepascal issue?
3.Yes, FileClose issue in the beginning!!!
4.Ubuntu file works perfect. No issue but with missing CloseFile in the beginning eof loading!

Thanks for the help.
/Robert
Rob

egsuh

  • Hero Member
  • *****
  • Posts: 1289
Re: I can't safe a text file in Windows 10?[SOLVED by Jamie] Many thanks...
« Reply #3 on: September 29, 2021, 05:16:36 am »
In Windows, I think it depends on the application program that opens the file. For example, if you open a file, let's say abc.csv, using NotePad, you can access the file without any problem with other applications. You can read and write the file, with the first Notepad open.  But if you open it with MS Excel, you cannot access it with other programs. So it seems that the 'opening' program somehow set the file accessibility.

 

TinyPortal © 2005-2018