U_FNDFIL

Search for a file

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall U_FNDFIL([filename], [mode], [channel], [base_channel][, I/O_mode])

Arguments

filename

(optional) The name of the file to find. (a)

mode

(optional) The mode in which the file is opened. (a)

channel

(optional) Returned with the channel on which the file is opened. (n)

base_channel

(optional) The base channel examined in the search for a file. (n)

I/O_mode

(optional) Returned with the mode of the found file. (a)

Discussion

U_FNDFIL searches for a file and determines if it is already open. It enables you to search for a file yourself and is most useful when you are converting existing applications. U_OPEN can perform this file searching automatically.

If filename is omitted or blank, U_FNDFIL searches for the file specified in the last U_FNDFIL call. If there’s no previous call, U_FNDFIL returns a value of 0 for channel and returns I/O_mode as blank.

If mode is omitted or blank, the first channel on which the file is opened, regardless of I/O_mode, is returned.

Channel is returned with a value of 0 if the file or the mode is not found. If channel is omitted, U_FNDFIL will not perform a search.

If you specify base_channel, all channels less than or equal to base_channel will not be examined for the filename. If you do not specify mode, U_FNDFIL will find the first channel after base_channel. You can thus create a loop, using a base_channel specification to get past the previous channel that was examined until the file is found.

Examples

The first example looks for a file “cusmas” that was opened in mode “I:I” and returns the channel on which the file is opened in variable cuschn.

xcall u_fndfil("cusmas", "i:i", cuschn)

The second example also looks for “cusmas” and returns the channel on which the file is opened in cuschn, but it also returns the I/O mode of the file in variable iomode.

xcall u_fndfil("cusmas",, cuschn,, iomode)

The third example looks for the file named “cusmas” opened in mode “I:I,” ignoring channels 1 through 3 and beginning with channel 4. It returns the channel on which the file is opened in cuschn.

xcall u_fndfil("cusmas", "i:i", cuschn, 3)