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 17 MAY 2000 09:38:20PM Jim Dierking wrote:

Well Don was right, xlating and writing a dos file works great

unless the variable goes over the 64k limit, which happened.

I used the code Aaron recommended to obtain the length of the

dos file. "Length=Dir('f:\arev3_1\datavol\export.txt')"

How can I write a null value to the last digit of the DOS file?

TIA for the help, Jim Dierking


At 17 MAY 2000 10:21PM Larry Wilson - TARDIS Systems, Inc. wrote:

something like:

* open the DOS file

CurPos=0

Done=0

loop

OSBREAD Chunk from DosFileVar at CurPos LENGTH 64000
  • * read 64K chunks
  • * Check status here - look at the R/Basic book
  • * set EOF if end of file
if EOF then
   CurPos += LEN(Chunk)
   Done=1
end else
   if Chunk then
      CurPos += LEN(Chunk)
  • look at Steve Smith's bugs page at:
      [url=http://www.ozemail.com.au/~stsm/top5.htm]Steve's Bug List[/url]
  • this checks for a bug in AREV
   end else
      CurPos -= 1
  • for some reason, EOF was missed on the last read, but this
  • is the end, so get the actual last pos
      Done=1
   end

until Done do

repeat

OSBREAD Chr from DosFileVar at CurPos LENGTH 1

if Chr=CHAR(26) then

  • * do you want to overwrite EOF?
  • * if so, just write, else CurPos -= 1 then write here

end else

 if you want to overwrite the last char, write at CurPos else
 CurPos += 1
 write whatever you want
 OSBWRITE newChar on DosFileVar at CurPos

end

be sure to look at Steve's remark.

tardis_systems@yahoo.com

http://AdvancedRevelation.com

(the icon below is real-time; if I'm not on, it asks to take a message

if I ring for a chat, you'll get a floating box that says to click

for a chat.)


At 17 MAY 2000 11:17PM Larry Wilson - TARDIS Systems, Inc. wrote:

Of course, if you don't need to look for anything else in the file, you could just do an INITDIR and DIR() and get the filezie then do a OSBREAD testchar from DosFileVar at FileSize-1 LENGTH 1 (remember that os OSBREAD, the file starts at 0, not 1) Then you don't need a loop.


At 18 MAY 2000 01:21AM Jim Dierking wrote:

Thanks for the help. Here's what worked…Jim

OSOPEN "UPS.TXT" TO UPS ELSE STOP

OSBWRITE "" ON UPS AT (Dir('f:\arev\UPS.txt') - 1)

OSCLOSE UPS


At 18 MAY 2000 01:39AM Larry Wilson wrote:

A few lines less than my first suggestion - nice succinct code.

Would you please send me your email address?

I thought that was you on the system around midnight but wasn't sure enough to try to trigger a chat (it's interesting what that little icon does!)

Later,

Larry


At 18 MAY 2000 09:16AM Don Miller - C3 Inc. wrote:

Just to be safe, check for the MOD 21930 bug before doing the read/write. See Steve Smith's top 5 AREV bugs. If you're at the magic number, back up one byte and read 1 byte. Then append your data to that byte and do the OSBWRITE there. E.G.

* COMPUTE BYTE POSITION TO WRITE AT AND STORE IT IN BYTE_POS

* CHECK FOR THE BAD PLACE PER STEVE AND SET FOOBAR TO 1 ELSE FOOBAR=0

IF FOOBAR THEN

BYTE_POS-=1
OSBREAD HUNK FROM WHATEVER_FILE AT BYTE_POS,1
HUNK:=MY_BYTE
OSBWRITE HUNK ON WHATEVER_FILE AT BYTE_POS

END ELSE

OSBWRITE MY_BYTE ON WHATEVER_FILE AT BYTE_POS

END

HTH

Don Miller

C3 Inc.

View this thread on the forum...

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