Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- GT_LIB v1.0 Reference Guide Release 1.0 - <b>find a string in a low level file.</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Find a string in a low level file.
------------------------------------------------------------------------------

 Syntax

        GT_FLocate(<nFileHandle>,<cString>,[<lCaseSensitive>],;
                   [<nStartPos>]) --> nLocation

 Arguments:

      <nFileHandle> is the handle of a file that has been opened or
      created with one of Clipper's low level file functions.

      <cString> is the string you are looking for.

      <lCaseSensitive> is an optional logical value to describe the
      type of search. If True (.T.) the search will be a case sensitive
      search. The default is False (.F.)

      <nStartPos> is an optional numeric value to describe the position
      at which the search will start. The default is 0.

 Returns:

      The byte location of the string if a match is found. -1 if there
      was an error reading the file. -2 if a match could not be found.

 Description:

      GT_FLocate() can be used to find a text string in a file that has
      been opened with one of Clipper's low level file functions.

      Note that as well as returning the location of the hit GT_Flocate()
      will also place the file pointer at the first byte of the match. If
      no match was found the file pointer will be in it's original
      location.

 Examples:

      // The following example opens a file and prints every byte location
      // of the target word.

      local nFile := fopen("LIFE.42")
      local nHit  := 0
      do while nHit >= 0
         if (nHit := GT_FLocate(nFile,"Meaning")) >= 0
            ? nHit
         endif
      enddo
      fclose(nFile)

 Source: FLOCATE.PRG

 Author:  Dave Pearson

See Also: GT_FTELL() GT_FSIZE()

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