quinta-feira, 5 de março de 2015

Texto EScever arquivo Texto

Texto EScever arquivo Texto



C:\WinDev 19\Examples\Training\WD Text Files\Exe

FileNum is int                    // Identifier used to handle the file
FilName is string = "D:\aleva\amarildo.txt"        // Name of the test file
Str is string                        // String to write into the test file
Str = CR+"I learn to work with text files"...
+CR+"It is really simple..."
// Create the FileName file
FileNum = fCreate(FilName)
IF FileNum = -1 THEN
    Error(StringBuild("Error creating file %1",FilName),ErrorInfo())
    RETURN
ELSE
    Info(StringBuild("File %1 has been created", FilName))
    fClose(FileNum)
END
// open the file
FileNum = fOpen(FilName,foWrite)
// Check the file opening
IF FileNum = -1 THEN
    // Error opening the file
    Error(StringBuild("Error opening %1",FilName),ErrorInfo())
ELSE
    fWrite(FileNum,StringBuild("Text written %1 to %2 ",DateToString(Today()),TimeToString(Now())))     // Write into the file
    fWrite(FileNum,Str)
    IF ErrorOccurred THEN
        // An error occurred while writing into the file
        Error(StringBuild("Error writing to %1",FilName),ErrorInfo())
    ELSE
        // Close the file
        fClose(FileNum)       
        Info(StringBuild("End of write operation in %1 file",FilName),"File Closed")
    END
END

Nenhum comentário:

Postar um comentário

Teste

Teste
teste