CRLF and LF in a text file

52 views
Skip to first unread message

poopall

unread,
Sep 3, 2021, 3:06:23 AMSep 3
to Harbour Users
I was wondering if anyone can help, I receive "text" files some of them have a LF end of line marker and others have a CRLF marker,

I read these into a dbf file using append delimited.

However where the file only has LF only 1 line is read, if it has CRLF, then it reads OK

Question: 
How can use both types of files  with both type of End of Line markers, so that append without issues.?



Mario H. Sabado

unread,
Sep 3, 2021, 4:10:49 AMSep 3
to 'elch' via Harbour Users
Hi,

Perhaps what you can do is to replace CRLF and LF with Hb_EOL() first?

cString :=Hb_MemoRead(cTextFile)
cString := Hb_StrReplace(cString,{CRLF,LF},{Hb_EOL(),Hb_EOL() } ) //replace CRLF,LF
MemoWrite(cTextFile,cString)
//proceed with append here

Regards,
Mario




--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/1ee827ec-127f-4953-924c-f1eb90ee2b50n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages