Creating a text file

Forum help and suggestions to improve this forum.

Moderator: Rathinagiri

Post Reply
Faiz
Posts: 4
Joined: Tue Oct 11, 2011 7:33 pm

Creating a text file

Post by Faiz »

Hi

Can anyone help?
I need to generate a TXT file
Previously in my Clipper DOS program I could SET Printer to filename
This does not seem to be available in HMG
User avatar
tave2009
Posts: 61
Joined: Tue Jul 14, 2009 3:33 am
Location: San Francisco, Córdoba, Argentina.

Re: Creating a text file

Post by tave2009 »

Español:
Hola,
El comando: Set Printer to <filename>
No esta disponible en la Librería HMG, pero si en Harbour

Ingles: (Google)
Hello,
The command: 'Set Printer to <filename>'
In the HMG library is unavailable. But if Harbour.

Slds.
Walter
Nada se pierde. Todo se transforma. (Lavoussier)
Nothing is lost. Everything changes.
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Creating a text file

Post by Rathinagiri »

You can use

Code: Select all

set alternate to 'x.txt'
This works in HMG.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Faiz
Posts: 4
Joined: Tue Oct 11, 2011 7:33 pm

Re: Creating a text file

Post by Faiz »

Set Alternate works

My thanks,
Never had the need to use this in Clipper
JALMAG
Posts: 262
Joined: Sun Jan 10, 2010 7:05 pm
DBs Used: DBF, MariaDB
Location: España - Spain

Re: Creating a text file

Post by JALMAG »

Este post creo que te vendrá muy bien.

This post will solve your doubts.

viewtopic.php?f=5&t=1192&p=8483&hilit=writefile#p8483
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Creating a text file

Post by esgici »

fread() / fwrite() ... etc are low-level functions and I'm always afraid LL approaches ;)

For building a text file programmatically my favorite way is something like this :

Code: Select all

cText := ''
...
<beginning of (probably necessarily) a loop ( FOR / WHILE ... ) >
   ...
   cLine := <somethings >

   cText += cLine + CRLF

<end of loop>

HB_MEMOWRIT( <output file name>, cText )
Regarding "viewing a text file", IMHO best way is EDITBOX; something like this:

Code: Select all

<NameOfEditboxControl>.value := MEMOREAD( <inputTextFileName> )
That's all 8-)


PS: Don't hesitate about 64 K limit, it left in DOS ;)

Regards / Saludos

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Creating a text file

Post by Rathinagiri »

Addendum to Esgici,

It is better to have the font of the editbox to be 'Courier New' so that the spacing will be equal between characters. Hmm. Good old days!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Creating a text file

Post by esgici »

rathinagiri wrote: It is better to have the font of the editbox to be 'Courier New' so that the spacing will be equal between characters. Hmm. Good old days!
Yes my friend :)

Or FixedSYS

In addition make background color to black and live a little nostalgia ;)

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
Post Reply