PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • 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 QueriesJavaUser code (UMC)
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 QueriesJavaUser code (UMC)
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)
PHPAjax
The following code is used to open an external file. The file is opened in read/write mode.
// Declare the variables
FileNameAndPath is string
FileID is int
// Select the file name and path
FileNameAndPath = "C:\MyDirectories\File.txt"
// 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 (WEBDEV)
PHPAjax
The following code is used to open and/or to create an external file. The file is opened in read/write mode. 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 = "C:\MyDirectories\File.txt"
// 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
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment