Writing To Multiple Text Files Simoultaneously, FT_F* way

Building a text file is quite easy in Clipper language: redirecting standard console output to a file is sufficient.

Methods for this redirection is SET ALTERNATE or SET PRINTER commands or TO FILE keyword for some screen-output commands.

Since basic process is "redirection", this methods doesn't support writing to more that one file at a same time.

This program is an essay to make possible this multiple text file output by using FT_F* functions of Nanforum toolkit.

A few higher level modules provided for easiness of using that library routines.

Now everything is in only three steps :

  - Open a text file by OpenOTF() function
  - Write line - by line the text to the file by KOUT command
  - Close the text file by CloseOTF() function

Only difference between KOUT commands with "?" command and QOUT() function is requirement of output file specifier with KOUT command as the first parameter. This specifier is simply a numeric value returned by OpenOTF(). More specific, this is a "Text File Work Area Number" provided and used by FT_F* library modules.

Remarks :

- This program uses Nanforum Toolkit modules, so required adding hbnf lib to the build script.   FE libs=hbnf to project configuration ( .hbc ) file or use a "call" command such as :

  call c:\hmg\build.bat WTMTFSFT -lhbnf

- The FT_FWRITELN() module has a drawback : it adds two CHR( 0 ) to end of each line written; as desribed here: http://www.hmgforum.com/viewtopic.php?f=35&t=3260. This problem also anounced in Harbour-Users forum (https://groups.google.com/forum/#!topic/harbour-users/0tAdHO6nmyY). If a solution found I will inform you; if you find please share.

- Regarding docs, Text File Work Area count is limited by 10. In reality, attempts to USE   more than 9 files, goes always Work Area # 9.

- Like SET ALTERNATE, left an empty line at top of file

For more information on FT_F* modules : http://vivaclipper.wordpress.com/2013/09/26/ft-text-file-management/
