[Gambas-user] save to a file
Rob
sourceforge-raindog2 at ...94...
Wed Dec 22 23:39:23 CET 2004
On Wednesday 22 December 2004 16:38, Jochen Georges wrote:
> File.Save("test2.txt", TextArea1.Text)
> this does not work.
> If the file already exist, i get a message "access forbidden".
> If it does not, i get a message "file or directory does not
> exist"
Specifying a filename with no path means you want to use the
current directory, which is usually the directory of your Gambas
project. This works fine when you're in the IDE, but after
you've compiled the project and made an executable, filenames
without paths refer to files embedded in your executable. Since
you can't write to embedded files like that, the language
prevents you from writing to files without pathnames even if
you're running the program from the IDE. (I personally think it
should simply write a file to the current directory as it exists
at runtime, and assume the programmer knows what he is doing,
but I am not Benoit ;) )
I would suggest using something like File.Save(System.Home &/
"test2.txt", TextArea1.Text).
Rob
More information about the User
mailing list