SET PRINT TO "TESTE.TXT"
SET DEVICE TO PRINT
@ 0,0 SAY "teste"
SET DEVICE TO SCREEN
SET PRINT TO
não deveria criar o arquivo TESTE.TXT e por como conteudo essa linha "teste"
pq até cria mas não grava nada dentro....
Moderador: Moderadores

Código: Selecionar todos
FUNCTION MAIN
SET PRINT TO "TESTE.TXT"
SET DEVICE TO PRINT
@ 0,0 SAY "teste"
SET DEVICE TO SCREEN
SET PRINT TO
RETURN 

Código: Selecionar todos
StrFile(): Writes a string to a file starting at a specified position.
Syntax
StrFile( <cString> , ;
<cFileName> , ;
[<lUseExisting>], ;
[<nOffset>] , ;
[<lTruncate>] ) --> nBytesWritten
Arguments
<cString>
This is a character string to be written to the file <cFileName>.
<cFileName>
This is a character string holding the name of the file to write to. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory only.
<lUseExisting>
This parameter defaults to .F. (false) so that a new file is created. To write <cString> to an existing file, <lUseExisting> must be set to .T. (true).
<nOffset>
This optional numeric parameter specifies the starting position for writing. It defaults to the end-of-file.
<lTruncate>
This parameter defaults to .F. (false). When set to .T. (true), the file is truncated after <cString> is written, i.e. the file ends with <cString>. Return
The function returns the number of bytes written to the file as a numeric value.
Example:
PROCEDURE Main
LOCAL cFileName := "Prg_files.txt"
LOCAL aFiles := Directory( "*.prg" )
LOCAL aFile
FOR EACH aFile In aFiles
StrFile( aFile[1] + HB_OsNewLine(), ;
cFileName, .T. )
NEXT
RETURN

Cleber no seu exemplo fiz como esta abaixo e gerou sem problemas:clebervn escreveu:Por exemplo, se tenho a seguinte sequencia de comandos :
SET PRINT TO "TESTE.TXT"
SET DEVICE TO PRINT
@ 0,0 SAY "teste"
SET DEVICE TO SCREEN
SET PRINT TO
não deveria criar o arquivo TESTE.TXT e por como conteudo essa linha "teste"
pq até cria mas não grava nada dentro....