In this chapter, we will discuss regarding some of the other functions that are available for files.
Sr.No. | Functions for Files |
---|---|
1 | Lines
This function returns either the value 1 or the number of lines left to read in an input stream. The filename is given as the input to the function. |
2 | stream
This function is used to check the status of a file. Sometimes it is required to check the status of a file before it is used. If the file is corrupt or not available, then no further operations can be performed on the file. So it makes more sense to first check the status of the file. |
3 | charin
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. |
4 | chars
This function returns either 1 or the number of characters left to read in the file itself. The filename is mentioned as a parameter to the function. |
5 | charout
This function is used to write one character at a time to a file. The filename is entered as a parameter to the function. |