Difference between pages "Allocated" and "Writestring"

From Mesham
(Difference between pages)
Jump to navigationJump to search
(Created page with '== Syntax == allocated[{type}] == Semantics == This type sets the memory allocation of a variable, which may not be modified once set. == Example == var i: Int :: allocated…')
 
m
 
Line 1: Line 1:
== Syntax ==
+
== Overview ==
  
allocated[{type}]
+
This writestring(f,a) function will write the value of ''a'' to the file denoted by handle ''f''.
  
== Semantics ==
+
* '''Pass:''' The [[File]] handle to write to and the [[String]] to write
 
+
* '''Returns:''' Nothing
This type sets the memory allocation of a variable, which may not be modified once set.
 
  
 
== Example ==
 
== Example ==
  
  var i: Int :: allocated[];
+
#include <io>
 +
  var f:=open("hello.txt","w");
 +
writestring(f,"hello - test");
 +
close(f);  
  
In this example the variable ''i'' is an integer. Although the ''allocated'' type is provided, no addition information is given and as such Mesham allocates it to each processor.
+
''Since: Version 0.41b''
  
[[Category:Type Library]]
+
[[Category:Function Library]]
[[Category:Composite Types]]
+
[[Category:IO Functions]]
[[Category:Allocation Types]]
 

Revision as of 18:42, 13 January 2013

Overview

This writestring(f,a) function will write the value of a to the file denoted by handle f.

  • Pass: The File handle to write to and the String to write
  • Returns: Nothing

Example

#include <io>
var f:=open("hello.txt","w");
writestring(f,"hello - test");
close(f); 

Since: Version 0.41b