Difference between pages "Directref" and "Open"

From Mesham
(Difference between pages)
Jump to navigationJump to search
 
 
Line 1: Line 1:
== Syntax ==
+
== Overview ==
  
directref[ ]
+
This open(n,a) function will open the file of name ''n'' with mode of ''a''.
  
== Semantics ==
+
* '''Pass:''' The name of the file to open of type [[String]] and mode of type [[String]]
 +
* '''Returns:''' A file handle of type [[File]]
  
This tells the compiler that the programmer might use this variable outside of the language (e.g. Via embedded C code) and not to perform certain optimisations which might not allow for this.
+
== Example ==
  
== Example ==
+
#include <io>
 +
 +
function void main() {
 +
    var f:=open("myfile.txt","r");
 +
    close(f);
 +
};
  
var pid:Int :: allocated[multiple[]] :: directref[];
+
''Since: Version 1.0''
  
[[Category:Type Library]]
+
[[Category:Function Library]]
[[Category:Compound Types]]
+
[[Category:IO Functions]]
[[Category:Attribute Types]]
 

Revision as of 14:36, 15 April 2013

Overview

This open(n,a) function will open the file of name n with mode of a.

  • Pass: The name of the file to open of type String and mode of type String
  • Returns: A file handle of type File

Example

#include <io>

function void main() {
   var f:=open("myfile.txt","r");
   close(f);
};

Since: Version 1.0