File: file_of_string.doc

package info (click to toggle)
hol-light 20190729-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 42,676 kB
  • sloc: ml: 637,078; cpp: 439; makefile: 301; lisp: 286; java: 279; sh: 239; yacc: 108; perl: 78; ansic: 57; sed: 39; python: 13
file content (31 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
\DOC file_of_string

\TYPE {file_of_string : string -> string -> unit}

\SYNOPSIS
Write out a string to a named file.

\DESCRIBE
Given a filename {fn} and a string {s}, the call {file_of_string fn s} attempts
to open the file {fn} for writing and writes the string {s} to it before
closing. If the file exists, it will be overwritten, and otherwise a new file
will be created.

\FAILURE
Fails if the file cannot be opened for writing.

\EXAMPLE
The call
{
  # file_of_string "/tmp/hello" "Hello world\nGoodbye world";;
  val it : unit = ()
}
will result in a file {/tmp/hello} containing the text:
{
Hello world
Goodbye world

\SEEALSO
string_of_file, strings_of_file.

\ENDDOC