COMMAND LINE PARAMATERS

 BBS: Inland Empire Archive
Date: 03-03-92 (17:38)             Number: 172
From: PAUL LANKOW                  Refer#: NONE
  To: ZACK JONES                    Recvd: NO  
Subj: COMMAND LINE PARAMATERS        Conf: (11) Modula-2

ZJ>I'm learing QuickBASIC - mainly from typing in programs ZJ>written in magazines ZJ>(but hey, I've gotta start somewhere). Anyway - one program I typed in ZJ>recently is called Qcopy and is from the Jan 90 issue of PC Hands On. ZJ>Basically what the program does is while copying a file it displays a ZJ>bargraph showing % completed. The program prompts you for the Source File ZJ>and Output file using INPUT statements. How can I ZJ>modify the program to pas ZJ>these two file names as command line paramaters? What ZJ>I'd like to be able t ZJ>do is type "Qcopy Sourcefile Outputfile" instead of using the INPUT ZJ>statements. Thanks in advace for the help. Take Care, Zack Jones. Zack, It would go something like this, assuming the strings as being SourceFile$ and OutputFile$, ok? cmd$ = COMMAND$ 'this gets everything on the command line, following ' the program name (Qcopy) p = instr (cmd$, " ") 'find the space between the file names if p=0 then 'if command line isn't in the right format Print "Usage: Qcopy <source> <destination>" print end endif SourceFile$ = left$(cmd$, p-1) 'get string before space OutputFile$ = Mid$(cmd$, p+1) 'get string after space And now, my friend, you're off to the races. Hope this helps. By the way, learning from other people's programs is one of the best ways to do it. * SLMR 2.1a * Unable to locate Coffee -- Operator Halted! --- WM v2.01 [Eval]/91-2236 * Origin: DON'T PANIC! Resistance is USELESS! 206-573-9411 (1:105/107)
Outer Court
Echo Basic Postings

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