The document outlines a set of methods for file handling in a programming context. It includes methods for checking file existence, assigning files, resetting file pointers, reading lines, and manipulating strings. Each method is described with its parameters and return types, focusing on operations related to text files.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
7 views1 page
Methods
The document outlines a set of methods for file handling in a programming context. It includes methods for checking file existence, assigning files, resetting file pointers, reading lines, and manipulating strings. Each method is described with its parameters and return types, focusing on operations related to text files.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Methods
1. FileExists(fileName: String): Boolean
This method takes a single argument, fileName, of type String, and returns a Boolean value indicating whether a file with the specified name exists in the file system. 2. AssignFile(f: Textfile; fileName: String) This method assigns a text file identified by fileName to a file variable f for subsequent file operations. It takes two arguments: a file variable f (passed by reference) and the name of the file (fileName) as a String. 3. Reset(var f: Textfile) Resets the file pointer to the beginning of the file associated with the file variable f. It takes one argument, a file variable f, passed by reference, representing the file to be reset. 4. EOF(fileVariable: Textfile): Boolean Checks if the end-of-file marker has been reached for the file associated with the file variable. 5. ReadLn(f: Textfile; var line: String) Reads the next line from the text file associated with the file variable f and stores it in the line variable. It takes two arguments: a file variable f (passed by reference) and a variable line of type String (also passed by reference) to store the read line. 6. Pos(subStr: String; str: String): Integer Returns the position of the first occurrence of substring subStr within the string str. It takes two arguments: subStr, the substring to search for, and str, the string in which to search for the substring. Returns an Integer representing the position of the substring within the string, or 0 if not found. 7. Copy(s: String; index, count: Integer): String Returns a substring of s starting at position index and consisting of count characters. It takes three arguments: s, the source string; index, the starting index (1-based) of the substring; and count, the number of characters to copy. 8. Delete(sourceStr: String; index, count: Integer): String Removes a specified number of characters from the source string starting at the given index and returns the modified string. 9. CloseFile(f: Textfile) Closes the file associated with the file variable f. It takes one argument, a file variable f, passed by reference, representing the file to be closed.