Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 05 FEB 1999 03:19:57PM B. Cameron wrote:

Below is a sample (stripped down) code of writing a Rev table

to a Dos file in Quote-comma-Quote format. This code will write

a Dos file greater than 64k or less than 64k.

It is something I have written and used lots of times. It is fairly straight

forward but does not include the needed file locking, or error msg routines etc., to make it complete (i.e. good code). It is meant as an example shell for anyone to make use of that might be looking for such an example on writing out to Dos file.

I hope it is useful to some. And, thanks for all the answers I have gotten.


DosFileName=xxxxxx.xxx"

*

Equ DEOFM to Char(26) ;* Dos End of File Mark

Equ DEORM to /0D0A/ ;* Dos End of Record Mark

Equ RecLen$ to 1024 ;* You may increase or decrease

*

* Create or overwrite a empty Dos file with end of file marker

*

OSClose DosFileName

OSWrite DEOFM on DosFileName

*

* Set the Offset (Where to begin reading Dos file from)

*

Offset=0

NoMore=0

*

* Loop through your Rev table

*

Loop

    Readnext @ID else NoMore=1

Until NoMore do

    Read item From RevFile, @ID then
       Ditem="
       Ditem=Quote(item)
       Ditem=Quote(item)
       Convert @FM to "," in xitem
  • Now append to the DosFile
       OSOpen DosFileName to Doshandle Then
             Loop
               OSBRead data From Doshandle at Offset length RecLen$
             Until Index(data,DEOFM,1)
                Offset += RecLen$
             Repeat
             data=Field(data,DEOFM,1):Ditem:DEOR:DEOFM)
             OSBWrite data on Doshandle At Offset
             OSClose Doshandle
         End 
    End

Repeat

*

Return 0


Please comment on any erroneous errors or improvements.

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/b9405dc3ecf1014f8525670f006fb0e0.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1