Difference between revisions of "Readchar"

From Mesham
Jump to navigationJump to search
(Created page with '== Overview == This readchar[n] function will read a character from a file with handle ''n''. The file handle maintains its position in the file, so after a call to read char th…')
 
m (5 revisions imported)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
  
This readchar[n] function will read a character from a file with handle ''n''. The file handle maintains its position in the file, so after a call to read char the position pointer will be incremented.
+
This readchar(f) function will read a character from a file with handle ''f''. The file handle maintains its position in the file, so after a call to read char the position pointer will be incremented.
  
* '''Pass:''' The file handle to read character from
+
* '''Pass:''' The [[File]] handle to read character from
* '''Returns:''' A character from the file type Char
+
* '''Returns:''' A character from the file type [[Char]]
  
 
== Example ==
 
== Example ==
  
  var a:=openfile["hello.txt","r"];
+
  #include <io>
var u:=readchar[a];
+
  closefile[a];  
+
function void main() {
 +
    var f:=open("hello.txt","r");
 +
    var u:=readchar(f);
 +
    close(f);  
 +
  };
 +
 
 +
''Since: Version 0.41b''
  
 
[[Category:Function Library]]
 
[[Category:Function Library]]
 
[[Category:IO Functions]]
 
[[Category:IO Functions]]

Latest revision as of 15:44, 15 April 2019

Overview

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

  • Pass: The File handle to read character from
  • Returns: A character from the file type Char

Example

#include <io>

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

Since: Version 0.41b