AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • Operating mode in Windows Vista (and later)
  • Equivalencia
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Crea y rellena un archivo de texto con el contenido de un control de texto o texto Variable (cadena Variable, control Campo de entrada en una ventana, control Estático en una reporte, ...). Si el archivo ya existe, se borra y se vuelve a crear.
Observación: Se soportan las cadenas que contienen "0" binario (" _ASLASH_0").
Ejemplo
WEBDEV - Código ServidorPHPAjax
// Fills the file with the content of a variable
MyTextString is string = "This is a test" + CR + "Using fSaveText"
fSaveText("C:\Temp\MyFile.txt", MyTextString)
 
// Fills the file with the content of a control
// EDT_LASTN_FIRSTN is an edit control
fSaveText("C:\Customers\LastFirstName.txt", EDT_LASTN_FIRSTN)
 
// Performs a file copy by replacing "Franc" by "Euro"
FileContent is string
FileContent = fLoadText("C:\Sales\FrancPrices.txt")
FileContent = Replace(FileContent, "Franc", "Euro")
fSaveText("C:\Sales\EuroPrices.txt", FileContent)
Sintaxis
<Result> = fSaveText(<Name and path of the text file> , <Content>)
<Result>: booleano
  • True si la operación fue exitosa,
  • False en caso contrario. Para obtener más información sobre el error, utilice la función ErrorInfo con la constante errMessage.
<Name and path of the text file>: Cadena de caracteres
Nombre y ruta completa (o relativa) del archivo de texto a crear. Se puede utilizar una ruta UNC.
WindowsLinux Este parámetro puede estar en formato Ansi o Unicode.
<Content>: Cadena de caracteres
Cadena que contiene el contenido del archivo.
Observaciones
WEBDEV - Código ServidorProcedimientos almacenados

Operating mode in Windows Vista (and later)

If this function does not work 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: If you need to manipulate / modify files or directories, without needing administrator privileges, it is advisable:
  • 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).
Observación: En Windows Vista (y posteriores), el mecanismo de virtualización se utiliza para hacer que las aplicaciones sean compatibles con Vista. Si el archivo se crea en un directorio del sistema sin tener suficientes derechos, este archivo se creará en otro directorio (C:\Users\<LOGIN>AppData\Local\VirtualStore\Windows\). En este caso, el archivo no puede ser compartido entre varias aplicaciones.
WEBDEV - Código ServidorPHPAjax

Equivalencia

La función fSaveText equivale al siguiente código:
// Opens the file in read-only
f is int = fOpen("C:\MyFile.txt", foCreate)
// Writes into the file
FileContent is string = "example of text"
fWrite(f, FileContent)
// Closes the file
fClose(f)
Componente: wd300std.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Video fSaveText
https://youtu.be/ygTOfO7xjcU

https://windevdesenvolvimento.blogspot.com/2019/05/dicas-2122-windev-webdev-mobile-xml-23.html

FOR EACH ROW OF TABLE_NOTAS_MANIFESTO
IF TABLE_NOTAS_MANIFESTO.COL_11_Xml_Nota<>"" THEN
conteudo_xml is string=TABLE_NOTAS_MANIFESTO.COL_11_Xml_Nota
arquivo_nome is string="C:\TEMP\XML_"+TABLE_NOTAS_MANIFESTO.COL_02_NUMERO_NOTA+".XML"
fSaveText(arquivo_nome,conteudo_xml)
END
END

amarildo
24 05 2019
abrir,modificar,gravar e Fechar Texto
abrir,modificar,gravar e Fechar Texto

EDT_Text1=""
_arquivo is string="E:\ALEVA\TESTE\AMARILDO.TXT"
_arquivo_id is int=fOpen(_arquivo,foReadWrite)
IF _arquivo_id<>-1 THEN
slinha is string=""
LOOP
slinha=fReadLine(_arquivo_id)
IF slinha=EOT THEN
BREAK
ELSE
EDT_Text1+=slinha+CR
END
END
END
fClose(_arquivo_id)

//Salvar Arquivo

_arquivo is string="E:\ALEVA\TESTE\AMARILDO.TXT"
fSaveText(_arquivo,EDT_Text1)


//Blog com Video e exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/09/curso-windev-arquivos-015-arquivos_8.html
https://www.youtube.com/watch?v=H9ZgfJ-vQ3s
De matos AMARILDO
08 09 2016
Ler Tabela Cliente e Gravar Txt Mobile
Ler Tabela Cliente e Gravar Txt Mobile

//Nessa aula vou ensinar como ler tabela cliente e gravar em txt no Mobile
//This class will teach how to read and write customer table in txt in Mobile
//Cette classe vous apprendra à lire et à écrire la table des clients dans txt à Mobile

s_nome_arquivo is string=CompleteDir(fCurrentDir())+"nome_arquivo.txt"
n_arquivo is int=fCreate(s_nome_arquivo)
//ver se arquivo deu erro
IF n_arquivo=-1 THEN
Info("erro na criação arquivo",ErrorInfo())
RETURN
END
s_monta is string=""
FOR EACH ROW OF TABLE_Cliente
HReadSeekFirst(cliente,id_cliente,TABLE_Cliente.COL_Id_cliente)
s_monta+="DADOS|"
s_monta+=cliente.id_cliente+"|"
s_monta+=cliente.razao_social_nome+"|"
s_monta+=cliente.telefone+CR
END
s_monta+="FIM|"
EDT_Texto_importar=s_monta
fSaveText(s_nome_arquivo,s_monta)

//proxima aula vou ler o txt e gravar no arquivo
//next class will read the .txt and write to the file
//la classe suivante va lire le .txt et écrire dans le fichier

//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/06/windev-mobile-65-matos-pedido-20-ler.html
https://www.youtube.com/watch?v=WQa93EJSGyE
De matos AMARILDO
23 06 2016

Última modificación: 24/08/2022

Señalar un error o enviar una sugerencia | Ayuda local