BBS: Inland Empire Archive Date: 10-05-92 (16:10) Number: 395 From: ROBERT CHURCH Refer#: NONE To: RICH GELDREICH Recvd: NO Subj: Re: Your qwk2txt.lzh/bas Conf: (2) Quik_Bas
> I posted a routine to do just that a day or two ago.
RG> Strange- as usual, my BBS didn't receive it.
I'll re-post. It wasn't very big.
FUNCTION GetArchive$ (FileName$)
'Returns the DOS command needed to un-archive the passed FileName$
'The archiver information is from the COMPRESS.CFG included in
'Scott Dudley's SquishMail message base utility. Thanks Scott!
Free = FREEFILE
OPEN FileName$ FOR BINARY AS #Free
DIM Ident AS STRING * 5 'We'll need the first five bytes of the file
GET #Free, , Ident 'GET the first five bytes
IF LEFT$(Ident, 1) = CHR$(26) THEN 'We know it's an ARC if the first
'byte is an EOF.
GetArchive$ = "arce " 'return the command to extract the ARC
ELSEIF LEFT$(Ident, 4) = "PK" + CHR$(3) + CHR$(4) THEN
'we know it's a zip if the first three bytes
GetArchive$ = "PKUNZIP " 'are "PK^C^D".
ELSEIF RIGHT$(Ident, 3) = "-lh" THEN
'If the 3 bytes at offset 2
GetArchive$ = "LHA E " 'are "-lh" then we know it's an LHA.
ELSEIF LEFT$(Ident, 2) = CHR$(96) + CHR$(234) THEN
'If the first 2 bytes of the file
GetArchive$ = "ARJ E " 'are CHR$(96) and CHR$(234), it`s an ARJ.
ELSE
GetArchive$ = "" 'unknow archive type
END IF
CLOSE
END FUNCTION
--- Maximus 2.00
* Origin: Programmer's Palace BBS (1:105/330.3)

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