Forum > FV/Textmode IDE

(SOLVED) Weird behavior opening a text file in FV editor

<< < (2/3) > >>

HotShoe:

--- Quote from: Thaddy on November 07, 2024, 07:44:28 am ---Can you open it readonly? (meaning Filemode:=0, default is 2, rw) With filemode = 0 reset should succeed. It is a simple global variable.
It seems that something goes wrong in the default file mode, because that tries rw on a r only file.

--- End quote ---

Sorry Thaddy, I forgot to mention that I have filemode:= 0 in the program just before the file is assigned. It's just strange that my other editor doesn't care as long as you have read permission, and neither does nano, jed, ted, etc hehe.

--- Jem

Thaddy:
Assign() on its own does not perform any file IO, it just assigns a filename to a handle. Rewrite and reselt() do perform the IO and on nixes map directly to the OS filedescriptor. (fpopen()) So it is already quite low level except you can not directly use all modifiers that are possible on unix.
If I create a text file as root and chmod it to 644 I can open it readonly as user.

BTW fpopen is simply an alias for fopen, nothing more.
What occurred to me that perhaps the file system itself is the cause.

HotShoe:
I don't understand it. I have written 4 routines now that all work, but the FV example does not so I will now rewrite the FileEditor.loadfile routine in FV and see what that does. In the mean time I have gone back to updating the Ncurses editor.

Just another example of my haunted systems.

Thanks,
--- Jem

mika:
HotShoe, if you are about to use Editor from FV, check latest bug fixes in Gitlab. Editors unit have been broken since very beginning. There are some other recent fixes that might be interesting.
I guess Reset might open file in read-write mode.

Thaddy:

--- Quote from: mika on November 11, 2024, 02:55:39 pm ---I guess Reset might open file in read-write mode.

--- End quote ---
Yes, that was the case as already mentioned. It is fixed since two days in trunk. filemode := 0; default := 2;

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version