Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

FindFileByName

Finds a file in the file system given a name.

Declaration

NINT ctDECL FindFileByName(pTEXT infilnam,NINT opcode,pTEXT outfilnam,pVRLEN poutfillen);

Short Name

ctFILWCD()

Description

This function allows file searches using the wildcard characters ‘?’ and ‘*’. The ‘?’ identifies a single character wildcard position while a ‘*’ specifies any number of characters.

  • infilnam is the wildcard filename
  • opcode is one of the following:

    FindFileByName opcode

    Explanation

    ctFILWCDfindfirst

    start new search

    ctFILWCDfindnext

    find next file

    ctFILWCDfindclose

    terminate current search

  • outfilnam is the buffer to hold the found filename
  • poutfillen points to the output buffer size

Note: The wildcard logic finds all files matching the wildcard specification — there is no check that the file is a c-tree data or index file. The wildcard logic also finds memory files whose names match the specified filename.

Result

Value

Symbolic Constant

Explanation

0

NO_ERROR

No error occurred.

See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.

Example pseudocode

#define MAX_SIZE 1024 /* 1K buffer size */

...

int ListLength = MAX_SIZE

pText pFilelist;

pFileList = (pText) malloc (sizeOf(pText) * MAX_SIZE);


...

memset(pFileList, 0, MAX_SIZE);

if ((rc = ctFILWCD ("jrnl*.dat", ctFILWDfindfirst, pFilelist, ListLength)) != 0 ) {

printf("ctFILWCD did not execute successfully (%d).\n, rc");

}

...

Limitations

ctFILWCD() does not translate path separators between client and server and does not provide a way to re-read the name of a file if the specified buffer is too small to hold the entire filename.

TOCIndex