Texto - Le por Linha
C:\WinDev 19\Examples\Training\WD Text Files\Exe
FilName is string = "toto.TXT" // Name of the test file
FileNum is int // identifier used to handle the test file
Line is string // Line currently read
TEXTFIL=""
// Open the test file in read-only
FileNum = fOpen(FilName,foRead)
IF FileNum = -1 THEN
// An error occurred while opening the file
Error(StringBuild("Error opening %1 file",FilName),ErrorInfo())
ELSE
// Read the file line by line
LOOP
// Read the next line in the file
Line=fReadLine(FileNum)
// Was the end of file reached?
IF Line = EOT THEN BREAK
// Refresh the text control
TEXTFIL = TEXTFIL+CR+Line
END
// Close the file
fClose(FileNum)
END
Nenhum comentário:
Postar um comentário