FileBrowser_GetSelectedFiles

int FileBrowser_GetSelectedFiles (int panel, int control, char ***files);

Purpose

Gets the current list of selected files and directories in the file browser. Depending on the ATTR_PATH_RELATIVE attribute, the list contains absolute paths or paths relative to the starting path of the file browser. The function sets the files parameter to point to an array of strings. The caller frees all of the strings and the array that contains the strings.

Parameters

Input
Name Type Description
panel integer The handle of the panel for the file browser.
control integer The ID of the file browser.
Output
Name Type Description
files char *** Buffer that contains an array of strings in which each string is the name of one of the files or directories selected. The last element of the array is a NULL pointer. The caller frees all of the strings and the array that contains the strings.

The following example illustrates how to free each string in the file list and then free the file list array itself.

char **files = NULL;

int status;

int i;


status = FileBrowser_GetSelectedFiles (panel, control, &files);

if (status >= 0) {

if (files) {

for(i=0; files[i] != NULL; i++) {

printf ("Selected File : %s\n", files[i]);

free (files[i]);

files[i] = NULL;

}

free (files);

files = NULL;

}

}

Return Value

Name Type Description
status integer Return value that indicates whether the function was successful. A negative number indicates that an error occurred. Call the GetGeneralErrorString toolbox function to get a descriptive error message.