This function is used to read one character at a time from a file. Sometimes programs require to read files character wise and hence this function can be used for this purpose.
filename − This is the name of the file from which the character needs to be read from.
A character read from the file.
/* Main program */ chr = charin(Example.txt) say chr chr = charin(Example.txt) say chr chr = charin(Example.txt) say chr
When we run the above program, we will get the following result.
E x a