Append from myfile.txt SDF

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
DenCo
Posts: 32
Joined: Wed Dec 29, 2010 5:12 pm
Location: Tennessee / USA
Contact:

Append from myfile.txt SDF

Post by DenCo » Fri Mar 08, 2013 4:09 am

There is one place I have found in the DOS/Windows environment where Clipper and Harbour are not the same...

I know the reason why, but would like to know how to work around it.

Here is the issue ... The simple command: Append from myfile.txt SDF will work in Clipper for most all types of text files...

Example,, You can have a regular DOS/Windows style text file where each line ends with (CR,LF),, or you can have a *nix style file where each line ends only with (LF)..

Your Clipper compiled program will load either one into your favorite DBF file with the simple command mentioned above... No problem...

Harbour in the DOS/Windows environment will not do this on the *nix style text files that have the "LF" only string ends.... It quits,, generally reading a partial one record and stops.

Harbour will work fine with the "CRLF" string ending text files ,, but not "LF" only ...

I can take any of these problem files and open them in notepad and "save as" a new file,, and Harbour works fine because the saved file has "CRLF" at the end of each line instead of "LF" .......

I would like to know the proper instruction in Harbour to read these *nix style text files.

A long time ago I read about this on the net, but at the time I wasn't dealing with the issue.. Today, I can't find the information I read at that time.

Thank You,
Bill

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Fri Mar 08, 2013 12:43 pm

DenCo wrote:Harbour will work fine with the "CRLF" string ending text files ,, but not "LF" only ...
Ohhh no, this is not correct. Harbour also has this diferance. Just set this:

SET( _SET_EOL, CHR(10) )

More details about this in: http://www.pctoledo.com.br/forum/viewto ... rom#p73188 (it is a portuguese forum, but you will find a button option for English/Espanish translations in upper of page site).
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
esgici
Posts: 4337
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 221 times
Been thanked: 77 times
Contact:

Post by esgici » Fri Mar 08, 2013 1:16 pm

Olá Pablo
Pablo César wrote:... this is not correct. Harbour also has this diferance. Just set this:
SET( _SET_EOL, CHR(10) )
...
Thanks for this tip :)

I didn't know SET( _SET_EOL, ... ) and thinking a program to convert LF to CRLF ...

Like "Captain Kirk" me too thanking you ;
applause.gif
Applause smiley
applause.gif (10.12 KiB) Viewed 1767 times
Viva INTERNATIONAL HMG :D

DenCo
Posts: 32
Joined: Wed Dec 29, 2010 5:12 pm
Location: Tennessee / USA
Contact:

Post by DenCo » Fri Mar 08, 2013 1:31 pm

Thank You Pablo.....

Oh,,, I new HB would handle it ... I just could not find the setting !!!!!

I will now go read all about it .... Thanks again, and also (hi esgici)

Bill

Leopoldo Blancas
Posts: 321
Joined: Wed Nov 21, 2012 7:14 pm
Location: México
Been thanked: 2 times

Post by Leopoldo Blancas » Fri Mar 08, 2013 5:56 pm

Hola Cesar....

En verdad eres un mago... :o

Saludos
Polo

User avatar
esgici
Posts: 4337
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 221 times
Been thanked: 77 times
Contact:

Post by esgici » Fri Mar 08, 2013 6:06 pm

Leopoldo Blancas wrote:Hola Cesar....

En verdad eres un mago... :o

Saludos
Polo
Google wrote:You really are a magician
Yes, agreed :)

Magic is knowing unknown ;)
Viva INTERNATIONAL HMG :D

Post Reply