ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Example: Opening an external file
  • Example: Opening and/or creating an external file
  • Example: Opening an external file (WEBDEV)
  • Example: Opening and/or creating an external file (WEBDEV)
Example: Opening an external file
Reports and Queries
The following code is used to open an external file. The file is opened in read/write mode. The file name and path are selected by fSelect.
// Declare the variables
FileNameAndPath is string
FileID is int
// Select the file name and path
FileNameAndPath = fSelect("", "", "Selecting an external file", ...
"External file" + TAB + "*.txt", "txt", fselCreate)
// Open file
FileID = fOpen(FileNameAndPath, foReadWrite)
// Display an error message if the opening was not performed
IF FileID = -1 THEN
  Error(ErrorInfo(errMessage))
ELSE
  // Processes in the opened file
  ...
  // End of processes
END
Example: Opening and/or creating an external file
Reports and Queries
The following code is used to open and/or to create an external file. The file is opened in read/write mode. The file name and path are selected by fSelect. If the file already exists, this file will not be re-created (foCreateIfNotExist constant).
// Declare the variables
FileNameAndPath is string
FileID is int
// Select the file name and path
FileNameAndPath = fSelect("", "", "Selecting an external file", ...
"External file" + TAB + "*.txt", "txt", fselCreate)
// Open file
FileID = fOpen(FileNameAndPath, foReadWrite + foCreateIfNotExist)
// Display an error message if the creation was not performed
IF FileID = -1 THEN
  Error(ErrorInfo(errMessage))
ELSE
  // Processes in the opened file
  ...
  // End of processes
END
Example: Opening an external file (WEBDEV)
Example: Opening and/or creating an external file (WEBDEV)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 08/23/2022

Send a report | Local help