# cbLogGetFileName()

Returns the name of the nth file in the directory containing binary log files.

## Function Prototype

C/C++

int cbLogGetFileName(int FileNumber, char* Path, char* Filename)

Visual Basic

Function cbLogGetFileName(ByVal FileNum&, ByVal Path$, ByVal Filename$) As Long

## Arguments

FileNumber

Index of the file whose name you want to return. Specify one of the following:

- The number (n) that represents the location of the file in the directory (where n = 0, 1, 2, and so on)
- GETFIRST - get the first file in the directory
- GETNEXT - get the next file in the directory, based on the current index.

This parameter is the index of the file in the directory, and is not part of the filename.

Path

The full path to the directory containing the binary file. The path must be NULL terminated, and cannot be longer than 256 characters.

Filename

A NULL terminated string containing the full path to the file.

## Returns

- Error code or 0 if no errors
- Filename – Returns a NULL terminated string containing the full path to the file.

## Notes

- Set FileNumber to GETFIRST to access the first binary file in a directory. Subsequent calls with FileNumber = GETNEXT returns each successive file in the directory. When you call the function after accessing the last file in the directory, the function returns the error code NOMOREFILES.