3.2.26. prompt_file

Displays an Open File dialog.

Note

This macro is not available in the headless debugger.

Syntax

int prompt_file(title, buff)
char *title;
char *buff;

where:

title

The text that appears in the title bar of the Open File dialog.

buff

The filename that appears in the File name text box of the dialog. Assign an empty string to leave the File name text box blank.

Contains the chosen path and filename of the opened file when the Open button is clicked.

Description

This macro displays an Open File dialog.

Assign an empty string to buff to leave the File name text box of the dialog blank.

Assign a filename, without a path, to buff before executing this macro, the filename appears in the File name text box of the dialog.

When you click Open, buff contains the chosen path and filename.

Return value

int

One of the following:

0

File opened.

1

Cancel.

Rules

None

Example

This example shows how to use prompt_file in a macro:

define /R void openFile()
{
  char filename[100];
  int retval;
  retval = prompt_file("Open File", filename);
  if (retval == 1)
    $printf "Open file cancelled!\n"$;
  else
    retval = fopen(100,filename,"r");    if (retval < 0)
      $printf "Could not open file: %s\n", filename$;
    else
      $printf "Opened file: %s\n", filename$;
}
.

See Also

Copyright © 2002-2009 ARM Limited. All rights reserved.ARM DUI 0175K
Non-Confidential