Difference between revisions of "Readline"

From Mesham
Jump to navigationJump to search
m
Line 9: Line 9:
  
 
  #include <io>
 
  #include <io>
  var f:=open("hello.txt","r");
+
   
var u:=readline(f);
+
function void main() {
close(f);
+
    var f:=open("hello.txt","r");
 +
    var u:=readline(f);
 +
    close(f);
 +
};
  
 
''Since: Version 0.41b''
 
''Since: Version 0.41b''

Revision as of 14:38, 15 April 2013

Overview

This readline(f) function will read a line (delimited by the new line character) from a file with handle f. The file handle maintains its position in the file, so after a call to readline the position pointer will be incremented.

  • Pass: The File handle to read the line from
  • Returns: A line of the file type String

Example

#include <io>

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

Since: Version 0.41b