GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
WINDEV 2024
→
LF (Linefeed)
LF (Linefeed)
Iniciado por Antonino Neri, set., 08 2010 5:56 PM - 3 respostas
Conecte-se…
Antonino Neri
#1
Publicado em setembro, 08 2010 - 5:56 PM
Hello everyone!
I need to handle an external file (output of a UNIX system) that uses the LF character as separator. When I use the fOpen function it correctly opens the file but reads only one string without CRs. The same thing happens if I open the file using the notepad. Instead if I open the file using Ultraedit everything shows the way it should.
I need WinDev 15 to handle this file as Ultraedit does. How can I do that?
Kindest Regards,
Antonino Neri
Denunciar
0
0
Stephen Myers
#2
Publicado em novembro, 07 2011 - 9:37 AM
I know this is an old post question, but I faced the same issue and found a solution I thought I'd share.
When reading unix files like a syslog file, I did a fReadLine. This actually reads the whole file since their is no CRLF to separate. The solution is to then do an ExtractString on Charact(10) [LineFeed], to get the lines of the unix file. Here is the code I used.
First I count the number of LF and then just do a loop to read the lines into a HF table.
nTmpfileid is int = fOpen(sTmpFileDirName)
IF nTmpfileid > 0 THEN
sTmpline = fReadLine(nTmpfileid)
nTmpCount is int = StringCount(sTmpline,Charact(10))
IF nTmpCount > 0 THEN
FOR i=1 TO nTmpCount
sTmpLine2 = ExtractString(sTmpline,i,Charact(10))
HReset(syslog_messages)
syslog_messages.syslogmessage = sTmpLine2
syslog_messages.syslog_filename = sInfilename
syslog_messages.syslog_source = sInFilesource
HAdd(syslog_messages)
END
END
fClose(nTmpfileid)
END
Hope this helps someone.
Denunciar
0
0
Antonino Neri
#3
Publicado em novembro, 07 2011 - 5:51 PM
Thanks for sharing Stephen!
This is very useful.
Cheers
Denunciar
0
0
Sams
#4
Publicado em setembro, 02 2020 - 8:48 PM
Dude thanks for your answer 9 Years later...
It was headhache on my side.
Denunciar
0
0
→ Voltar para WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versões anteriores)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Tipo de Pesquisa
Apenas tópicos
Todas as mensagens
Período de pesquisa
Qualquer momento
Última hora
Últimas 24 horas
Semana passada
Mês passado
Ano passado
Cancelar
Pré-visualização da sua mensagem
Adicionar imagem
Importar uma imagem de uma URL
Enviar uma imagem a partir do seu disco
Deixe um ficheiro ou clique em "Procurar ..."
ou
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto