TURBO PASCAL |
Новости
|
18: How can I obtain the entire command line (spaces and all)?A: ParamCount and ParamStr are for parsed parts of the command line and cannot be used to get the command line exactly as it was. See what happens if you try to capture "Hello. I'm here" you'll end up with a false number of blanks. For obtaining the command line unaltered use type CommandLineType = string[127]; var CommandLinePtr : ^CommandLineType; begin CommandLinePtr := Ptr(PrefixSeg, $80); writeln (CommandLinePtr^); end; A warning. If you want to get this correct (the same goes for TP's own ParamStr and ParamCount) apply them early in your program. At least they must be used before any disk I/O takes place! : A related example demonstrating a function giving the number of characters on the command line function CMDNBRFN : byte; var paramPtr : ^byte; begin paramPtr := Ptr (PrefixSeg, $80); cmdnbrfn := paramPtr^ end; (* cmdnbrfn *) For the contents of the Program Segment Prefix (PSP) see Tischer, Michael (1992), PC Intern System Programming, p. 753. |
(с)Все права защищены По всем интересующим вопросам прошу писать на электронный адрес |