Debian Codegraph @

docs/manual/_tryToWriteFile_.html

raw symbols SCIP
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>tryToWriteFile</title>
3 <style>
4 td { padding-left: 5pt; padding-right: 5pt; }
5 th { padding-left: 5pt; padding-right: 5pt; }
6 code { white-space: pre-wrap; }
7 dd { white-space: pre-wrap; }
8 </style>
9 </head><body bgcolor="#FFFFFF">
10
11 <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Monaco,Courier" size=6 color="#999900"><b>
12 tryToWriteFile
13 </b></font></table></table>
14 <p>A function that can be used in <a href="Scripting.html">Scripting</a>.</p>
15 <h2>Syntax and semantics</h2>
16 <dl>
17 <dt><b><code><font size=+1>tryToWriteFile</font></code></b> (<i><code><font size=+1>filePath$</font></code></i>)
18 <dd>check whether this file can be written to.</dd>
19 </dl>
20 <p>The file is opened for writing, then closed (if the file already existed, it is emptied!).</p>
21 <h2>Return value</h2>
22 <p>Upon success (i.e. the file already existed and was successfully emptied, or the file didn&#8217;t exist yet but was successfully created), this function returns 1 (true). Otherwise, the function returns 0 (false); this can happen if the folder in the path does not exist, or if the file is (or would be) on a read-only device.</p>
23 <p>For instance, if my TIMIT database is in a read-only disk image called <code><font size=+1>TIMIT.dmg</font></code>, and I mounted that disk image on my Mac (by double-clicking <code><font size=+1>TIMIT.dmg</font></code>), then trying</p>
24 <code> <b>tryToWriteFile</b> ("/Volumes/TIMIT/hello.txt")<br></code>
25 <p>would return 0.</p>
26 <h2>Related function</h2>
27 <p>For a non-destructive version of this function, see <code><font size=+1>tryToAppendFile</font></code>.</p>
28 <h3>Links to this page</h3>
29 <ul>
30 <li><a href="Functions.html">Functions</a>
31 <li><a href="What_was_new_in_6_2_.html">What was new in 6.2?</a>
32 </ul>
33 <hr>
34 <address>
35 <p>© Paul Boersma 2023</p>
36 </address>
37 </body>
38 </html>