[scilab-Users] overwriting files with write()

Mike Page Mike at Page-One.Waitrose.com
Wed Jul 6 22:26:39 CEST 2011


Hi,

You can use errcatch to trap the error and take some action.  For example
when opening a file named in the string variable "Path" you can use:

            Err = execstr ("mdelete (Path);", 'errcatch');
            File = file ('open', Path, 'new');

The first line deletes the file, catching an error if the file doesn't
exist.  Then you can open it as type 'new' whether or not it already exists.

Hope that helps,
Mike.


-----Original Message-----
From: lukeaarond [mailto:lukeaarond at gmail.com]
Sent: 06 July 2011 21:19
To: users at lists.scilab.org
Subject: [scilab-Users] overwriting files with write()


I am saving a string with the function write:

write('name.txt',string);

However, if there is already a file called 'name.txt' in the directory then
the write() function stops and will not save the string. How do I get
write() to overwrite files?

--
View this message in context:
http://mailinglists.scilab.org/overwriting-files-with-write-tp3146073p314607
3.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at
Nabble.com.

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1388 / Virus Database: 1516/3747 - Release Date: 07/06/11




More information about the users mailing list