BBS: Inland Empire Archive Date: 07-05-92 (10:52) Number: 2 From: JAMES VAHN Refer#: 2050 To: JOHN GALLAS Recvd: NO Subj: thought... Conf: (2) Quik_Bas
JG> I was thinking about how that locode program can take any 3 chars, and JG> make them into 4 postable chars.. Would it be possible to take 4 JG> postable chars, and make them into 3 <0-255> chars, and then process JG> that through datamkr? Cause then the file wouldn't be as big as normal, JG> and you'd have datamkr's checksum thingy, and it'd be self-uncompressing JG> from QB. Would it work? Yes. That's what (I hope) is being worked on. There has been enough info exchanged to explain this, but if you missed the brunt of it I'll toss some code off the top of my head.. Complete with bugs! Just the encoding stuff though, the rest is up to you. open "xxx.com" for binary as #1 open "xxx.uue" for output as #2 inst$=space$(3) ' get three bytes at a time (bug!). cnt = 0 ' setup a line counter. do get #1,,inst$ byte1 = mid$(inst$,1,1) ' Split into 3 bytes.. byte2 = mid$(inst$,2,1) ' that's the reason for the ^^(bug) byte3 = mid$(inst$,3,1) ' LongByte& = (byte1 * 2^16) + (byte2 *2^8) + byte3 uue1% = LongByte& / 2^18 ' uue2% = (LongByte& - uue1%) / 2^12 ' break into 4 parts uue3% = (LongByte& - uue1% - uue2%) / 2^6 ' uue4% = LongByte& - uue1% - uue2% - uue3% ' print #2, chr$(uue1# +32); ' print all four, including print #2, chr$(uue2# +32); ' the (bug). print #2, chr$(uue3# +32); print #2, chr$(uue4# +32); cnt = cnt + 4 if cnt = 68 then print #2,: cnt = 0 loop until loc(1) >= lof(1) ' inst$ being 3 bytes, QB will often ' read past the end of the file. ' Same (bug). close end I suppose it could write out the file length for the decoder to strip the (bug) from, eh? * SLMR 2.1a *
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET