|
| Iniciado por antonino_neri, 08,sep. 2010 17:56 - 3 respuestas |
| |
| | | |
|
| |
| Publicado el 08,septiembre 2010 - 17:56 |
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 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 07,noviembre 2011 - 09:37 |
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. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 07,noviembre 2011 - 17:51 |
Thanks for sharing Stephen!
This is very useful.
Cheers |
| |
| |
| | | |
|
| | |
| |
| Publicado el 02,septiembre 2020 - 20:48 |
Dude thanks for your answer 9 Years later... It was headhache on my side. |
| |
| |
| | | |
|
| | | | |
| | |
|