PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Managing errors
  • Operating mode in Windows Vista (and later)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Creates an external file. This file is automatically opened in read/write.
Notes:
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WINDEVWEBDEV - Server codeReports and QueriesJavaPHPAjaxUser code (UMC)
// Create the external file
ResCreation = fCreate("C:\MyDirectories\File.txt")
IF ResCreation <> -1 THEN
...
END
Windows Mobile
// Create the external file
ResCreation = fCreate("\MyDirectories\File.txt")
IF ResCreation <> -1 THEN
...
END
Syntax
<Result> = fCreate(<File Path> [, <Creation Options>])
<Result>: Integer
  • Identifier of external file. This identifier will be used by all the functions for handling the external files.
  • -1 if an error occurred. To find out the error details, use ErrorInfo associated with the errMessage constant.
<File Path>: Character string (with quotes)
Name and full (or relative) path of file (up to 260 characters). The extension of the file can be specified. By default, if the file extension is not specified, the external file will have no extension. A UNC path can be used.
Note: If the external file already exists (same directory and same name), this file is destroyed and re-created. To avoid deleting an existing file, use fOpen associated with the foCreateIfNotExist constant.
Versions 15 and later
AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: In Android, an application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
New in version 15
AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: In Android, an application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: In Android, an application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
Windows Mobile This path must be a full path or a UNC path. It cannot be a relative path.
Versions 16 and later
Universal Windows 10 App Windows Phone: The file path corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
Reminder: Only the files found in the data directory associated with the application can be handled.
New in version 16
Universal Windows 10 App Windows Phone: The file path corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
Reminder: Only the files found in the data directory associated with the application can be handled.
Universal Windows 10 App Windows Phone: The file path corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
Reminder: Only the files found in the data directory associated with the application can be handled.
Versions 17 and later
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, an application has the rights to write into its setup directory or into one of its sub-directories.
New in version 17
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, an application has the rights to write into its setup directory or into one of its sub-directories.
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, an application has the rights to write into its setup directory or into one of its sub-directories.
<Creation Options>: Combination of optional constants
Options for file creation:
  • Lock options: A lock can be implemented when the external file is opened:
    foWriteLockThe file will be created in write-only. The other applications that use this file will not be able to modify it.
    foReadLockThe file will be created in read-only. The other applications that use this file will not be able to read it.
Versions 17 and later
  • Type of external file to create. This type is used by fReadLine and fWriteLine to define the type of information to read and write in the external file:
    foAnsiAnsi file. This constant is used to manage an Ansi file when the "Use the Unicode strings at run time" mode is enabled in the project configuration.
    This mode is used by default in the WINDEV and WEBDEV projects.
    foUnicodeUnicode file. This constant is used to manage a Unicode file when the "Use the Ansi strings at run time" mode is enabled in the project configuration.
    This mode is used by default in the WINDEV Mobile projects.
New in version 17
  • Type of external file to create. This type is used by fReadLine and fWriteLine to define the type of information to read and write in the external file:
    foAnsiAnsi file. This constant is used to manage an Ansi file when the "Use the Unicode strings at run time" mode is enabled in the project configuration.
    This mode is used by default in the WINDEV and WEBDEV projects.
    foUnicodeUnicode file. This constant is used to manage a Unicode file when the "Use the Ansi strings at run time" mode is enabled in the project configuration.
    This mode is used by default in the WINDEV Mobile projects.
  • Type of external file to create. This type is used by fReadLine and fWriteLine to define the type of information to read and write in the external file:
    foAnsiAnsi file. This constant is used to manage an Ansi file when the "Use the Unicode strings at run time" mode is enabled in the project configuration.
    This mode is used by default in the WINDEV and WEBDEV projects.
    foUnicodeUnicode file. This constant is used to manage a Unicode file when the "Use the Ansi strings at run time" mode is enabled in the project configuration.
    This mode is used by default in the WINDEV Mobile projects.

By default, if no constant is specified:
  • the external file can be freely accessed by the other applications,
  • the type of the file corresponds to the default mode.
AndroidAndroid Widget iPhone/iPadWindows MobileJavaPHP This parameter is not available. The external file can be freely accessed by the other applications.
Remarks

Managing errors

fCreate generates an error in the following cases:
  • the file is locked by another computer or by another application,
  • the user has no write rights in the creation directory.
  • a Unicode string was used for <File Path> in an operating system such as Windows 98 or Windows Me.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)

Operating mode in Windows Vista (and later)

If this function does not operate properly in Windows Vista (and later), check whether the file used is not found in one of the system directories (Windows directory or "Program Files" directory).
Indeed, in Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have the administrator privileges to handle and/or modify the files found in the system directories (Windows directory or "Program Files" directory).
Programming tip: To handle and/or modify the files without having administrator privileges, you should:
  • avoid writing into the Windows directory or into the "Program Files" directory,
  • use the system directory corresponding to the application (returned by SysDir associated with the srCommonAppData constant).
Note: In Windows Vista (and later), the virtualization mechanism is used to make the applications compatible with Vista. If the file is created in a system directory without having sufficient rights, this file will actually be created in another directory (C:\Users\<LOGIN>AppData\Local\VirtualStore\Windows\). In this case, the file cannot be shared between several applications.
Related Examples:
Handling text files Unit examples (WINDEV): Handling text files
[ + ] Handling "text" files with WINDEV:
- Create a text file
- Write into a text file
- Read in a text file
Handling text files Unit examples (WEBDEV): Handling text files
[ + ] This example explains how to handle "non HFSQL" files with WEBDEV and it allows you to:
- Create a text file
- Write into a text file
- Read in a text file
Handling text files Unit examples (WINDEV Mobile): Handling text files
[ + ] Handling external "text" files:
- Create a text file
- Write into a text file
- Read in a text file
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment