PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Operating mode in Windows Vista (and later)
  • Equivalence
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Creates and fills a text file with the content of a text control or text variable (string variable, edit control in a window, Static control in a report, ...). If the file already exists, it is deleted then re-created.
Remark: The strings containing binary "0" ("\0") are supported.
Example
Reports and Queries
// Remplit le fichier avec le contenu d'une variable
MaChaîneTexte is string = "Ceci est un test" + CR + "Utilisation de fSauveTexte"
fSaveText("C:\Temp\MonFichier.txt", MaChaîneTexte)
 
// Remplit le fichier avec le contenu d'un champ
// SAI_NOM_PRENOM est un champ de saisie
fSaveText("C:\Clients\NomPrenom.txt", SAI_NOM_PRENOM)
 
// Effectue une copie de fichier en remplaçant "Franc" par "Euro"
ContenuFichier is string
ContenuFichier = fLoadText("C:\Soldes\PrixFrancs.txt")
ContenuFichier = Replace(ContenuFichier, "Franc", "Euro")
fSaveText("C:\Soldes\PrixEuros.txt", ContenuFichier)
Syntax
<Result> = fSaveText(<Name and path of the text file> , <Content>)
<Result>: Boolean
  • True if the operation was successful,
  • False otherwise. To get the details of the error, use ErrorInfo with the errMessage constant.
<Name and path of the text file>: Character string
Name and full (or relative) path of text file to create. A UNC path can be used.
Versions 15 and later
Windows This parameter can be in Ansi or Unicode format.
New in version 15
Windows This parameter can be in Ansi or Unicode format.
Windows This parameter can be in Ansi or Unicode format.
<Content>: Character string
String containing the content of the file.
Remarks
Reports and QueriesStored procedures

Operating mode in Windows Vista (and later)

If this function does not operate properly in Windows Vista (and later), check whether the file or directory used is not in one of the system directories (Windows directory or "Program Files" directory).
In Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have administrator privileges to handle and/or modify the files or directories in system directories (Windows directory or "Program Files" directory).
Programming tip: To handle and/or modify the files or directories without administrator privileges, you should:
  • avoid writing to the Windows directory or to the "Program Files" directory,
  • use the system directory of the application (returned by SysDir with the srAppDataCommun constant, for example).
Remark: 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.
Reports and Queries

Equivalence

The function fSaveText is equivalent to the following code:
// Ouvre le fichier en lecture
f is int = fOpen("C:\MonFichier.txt", foCreate)
// Ecrit dans le fichier
ContenuFichier is string = "exemple de texte"
fWrite(f, ContenuFichier)
// Ferme le fichier
fClose(f)
Component: wd270std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment