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!
