Page 1 of 1

Append from myfile.txt SDF

Posted: Fri Mar 08, 2013 4:09 am
by DenCo
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

Re: Append from myfile.txt SDF

Posted: Fri Mar 08, 2013 12:43 pm
by Pablo César
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).

Re: Append from myfile.txt SDF

Posted: Fri Mar 08, 2013 1:16 pm
by esgici
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  smiley
Applause smiley
applause.gif (10.12 KiB) Viewed 13472 times

Thank You -> Re: Append from myfile.txt SDF

Posted: Fri Mar 08, 2013 1:31 pm
by DenCo
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

Re: Append from myfile.txt SDF

Posted: Fri Mar 08, 2013 5:56 pm
by Leopoldo Blancas
Hola Cesar....

En verdad eres un mago... :o

Saludos
Polo

Re: Append from myfile.txt SDF

Posted: Fri Mar 08, 2013 6:06 pm
by esgici
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 ;)