Browse Source

Add a files service for writing out files

Yentl Van Tendeloo 6 years ago
parent
commit
e280f339e5
2 changed files with 26 additions and 0 deletions
  1. 25 0
      bootstrap/files.alc
  2. 1 0
      interface/HUTN/includes/files.alh

+ 25 - 0
bootstrap/files.alc

@@ -0,0 +1,25 @@
+include "primitives.alh"
+include "services.alh"
+
+String function files_connect():
+	String port
+	port = ""
+	while (port == ""):
+		port = comm_connect("files")
+	return port!
+
+Boolean function write_file(filename : String, content : String):
+	String port
+	String result
+
+	port = files_connect()
+	comm_set(port, filename)
+	comm_set(port, content)
+
+	result = comm_get(port)
+	comm_close(port)
+	if result == "Success":
+		return True!
+	else:
+		log("Error in writing to file: " + result)
+		return False!

+ 1 - 0
interface/HUTN/includes/files.alh

@@ -0,0 +1 @@
+Boolean function write_file(filename : String, content : String)