Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- ClipOn 3.0 Reference - c_filestr() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 C_FILESTR()

 DESCRIPTION

 C_FILESTR() searches the specified file, beginning at the current
 file position, for the given string.

 NOTES

 C_FILESTR() begins searching at the current file position and moves
 the file pointer to the first letter of the matching text.  If no
 match is found, the file pointer is not moved.

 This function is an extension of Clipper's low-level file
 functions.  Clipper's function FOPEN() can be used to open the DOS
 file and obtain the file handle needed for this function.

 SYNTAX

 C_FILESTR(handle, string [,exact_match] [,bufsize])

 PARAMETERS

 handle (N) is the file handle to search.

 string (C) is the character string to search for in the file.

 exact_match (L) determines whether or not the string parameter must
 exactly match, with regard to case, the text in the file.  If
 exact_match is true (.T.) then the string must exactly match the
 text from the file.  If exact_match is false (.F.) then the case of
 the string and the text from the file are ignored.  If exact_match
 is not specified, the default of true (.T.) is used.

 bufsize (N) is the size of the buffer to use, between 1-32,000
 bytes, to speed the search for the string.  If bufsize is not
 specified, the default size of 2048 bytes is used.

 RETURNS

 C_FILESTR() returns the file position of the string if found, or
 negative one (-1) if not found.

 EXAMPLES

 && This example shows how to find multiple occurrences of a string
 && in a text file
 buffer = space(16)
 fh = fopen("FILE.TXT")      && Open the file

 && Find the first occurrence (assume the string was found)
 pos = c_filestr(fh, "STRING TO FIND")

 && Read the string using Clipper's FREAD() function which will read the
 && string from the file and will position the file pointer one byte
 && beyond the string.  Call C_FILESTR() again to find the next occurrence.
 do while pos != -1
   fread(fh,@buffer,16)
   ? buffer
   pos = c_filestr(fh, "STRING TO FIND")
 enddo


See Also: C_FILEPOS() C_FILEREAD() C_FILEGRAB() C_FILESIZE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson