home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY1 / EXAMP2.ZIP / PB091190 < prev    next >
Text File  |  1990-09-11  |  8KB  |  259 lines

  1. all
  2. H#: 65035 S12/SPECTRA Publishing
  3.     10-Sep-90  20:05:35
  4. Sb: #64142-#Peace and Quiet !
  5. Fm: John Watts 73760,751
  6. To: Bob Zale: PowerBASIC R&D 76304,1303 (X)
  7.  
  8. Bob,
  9.        The following is a sub I wrote to parser the command line. It uses
  10. EXTRACT$ & REMOVE$ so it may help someone who has never used these two
  11. functions to appreciate their power.
  12.  
  13. ' This sub routine parsers the command line ' ' You must dimension an array to
  14. the maximum number of parameters expected ' It returns this array and the
  15. number of active elements
  16.  
  17. sub parser(CommandLine$(),NumElem%)
  18.        NumDim%  = NumElem%
  19.        NumElem% = 0
  20.        C$ = ucase$(command$)
  21.        while len(C$) > 0
  22.                incr NumElem%
  23.                CommandLine$(NumElem%) = extract$(C$," ")
  24.                C$ = remove$(C$,CommandLine$(NumElem%)+" ")
  25.                if NumElem% = NumDim% then exit sub
  26.        wend end sub
  27.  
  28. Example:
  29.  
  30. Dim X$(1:6)    'Allow for a maximum of 6 parameters Call Parser(X$,6)
  31.  
  32. 'Now X$(1) thru X$(6) will contain the parameters of the command line
  33.  
  34. For x% = 1 to 6
  35.        print X$(x%) next x% end
  36.  
  37. PS:
  38.        I would like to thank you ( Bob ).  With out you the above code would
  39. not be possible.  Keep up the good work.
  40.  
  41.                                        Best wishes
  42.                                           John
  43.  
  44. There is 1 Reply.
  45.  
  46. Press <CR> for next or type CHOICES !
  47. H#: 65047 S12/SPECTRA Publishing
  48.     10-Sep-90  20:39:44
  49. Sb: #65035-#Peace and Quiet !
  50. Fm: John Watts 73760,751
  51. To: John Watts 73760,751 (X)
  52.  
  53. Sorry about the garbage. Here's the code again.....( I hope )
  54.  
  55. ' This sub routine parsers the command line ' You must dimension an array to
  56. the maximum number of parameters expected ' It returns this array and the
  57. number of active elements
  58.  
  59. sub parser(CommandLine$(),NumElem%)
  60.        NumDim%  = NumElem%
  61.        NumElem% = 0
  62.        C$ = ucase$(command$)
  63.        while len(C$) > 0
  64.                incr NumElem%
  65.                CommandLine$(NumElem%) = extract$(C$," ")
  66.                C$ = remove$(C$,CommandLine$(NumElem%)+" ")
  67.                if NumElem% = NumDim% then exit sub
  68.        wend end sub
  69.  
  70. Example:
  71.  
  72. Dim X$(1:6)    'Allow for a maximum of 6 parameters Call Parser(X$,6)
  73.  
  74. 'Now X$(1) thru X$(6) will contain the parameters of the command line
  75.  
  76. For x% = 1 to 6
  77.        print X$(x%) next x% end
  78.  
  79.  
  80.  
  81.  
  82. There is 1 Reply.
  83.  
  84. Press <CR> for next or type CHOICES !
  85. H#: 65050 S12/SPECTRA Publishing
  86.     10-Sep-90  20:51:53
  87. Sb: #65047-#Peace and Quiet !
  88. Fm: John Watts 73760,751
  89. To: John Watts 73760,751
  90.  
  91. Well I tried..........would someone please tell me what went wrong. I'm using
  92. the old TB editor along with tapcis.
  93.  
  94. I guess you'll just have to figure out where to put the carriage returns.
  95.  
  96.                                                Good luck
  97.                                                John
  98.  
  99.  
  100.  
  101. There are 3 Replies.
  102.  
  103. Press <CR> for next or type CHOICES !
  104. H#: 65089 S12/SPECTRA Publishing
  105.     11-Sep-90  06:33:31
  106. Sb: #65050-Peace and Quiet !
  107. Fm: Dan Robins 70007,3264
  108. To: John Watts 73760,751
  109.  
  110. John,
  111.    I don't use TAPCIS....but to POST UNFORMATTED would take care of
  112. the problem.
  113.   Dan
  114.  
  115.  
  116. Press <CR> for next or type CHOICES !
  117. H#: 65100 S12/SPECTRA Publishing
  118.     11-Sep-90  07:33:22
  119. Sb: #65050-Peace and Quiet !
  120. Fm: Paul Johnson 73577,646
  121. To: John Watts 73760,751
  122.  
  123. John -
  124.  
  125. When using TAPCIS, or anything else to upload a text file, if you want to
  126. preserve the appearance of the original file, insert a space at the beginning
  127. of each line in the editor, before uploading/transmitting it. This includes
  128. blank lines, which should contain 1 space.  See these examples:
  129.  
  130.  Line 1 - This line has a leading space.
  131.  Line 2 - This line has a leading space.
  132.  
  133.  Line 1 - This line has a leading space. Line 2 - There's no leading space
  134. here, so it should have wrapped onto the end o preceding line (compuserve does
  135. this automatically)
  136.  
  137. It's a common problem, but an easy solution.  If you used a WP program to
  138. compose your messages or files, you could set the left margin to 1 character
  139. and print to an ASCII file.  TB/PB won't let you set a left margin, nor will it
  140. support blank lines with a single space, so it's not an ideal editor for these
  141. purposes.
  142.  
  143. Hope that helps - good luck!
  144.  
  145.                                - Paul
  146.  
  147.  
  148.  
  149. Press <CR> for next or type CHOICES !
  150. H#: 65103 S12/SPECTRA Publishing
  151.     11-Sep-90  07:47:32
  152. Sb: #65050-Peace and Quiet !
  153. Fm: Bob Zale: PowerBASIC R&D 76304,1303
  154. To: John Watts 73760,751
  155.  
  156. Thanks for the example code, John.  I'm sure many will find it interesting.
  157. Thanks for the "pat on the back", too!  My ego loves it!
  158.   Bob Zale (PowerBASIC R&D)
  159.  
  160. Press <CR> for next or type CHOICES !
  161. H#: 65093 S12/SPECTRA Publishing
  162.     11-Sep-90  06:51:23
  163. Sb: #64657-#Peace and Quiet !
  164. Fm: Mason Landstreet 71220,1547
  165. To: Bob Zale: PowerBASIC R&D 76304,1303 (X)
  166.  
  167. Bob,
  168.  
  169. I'm already sold. How do I sign upso my name will be near the top of the list?
  170.  
  171. Thanks..........................................Mason
  172.  
  173. There is 1 Reply.
  174.  
  175. Press <CR> for next or type CHOICES !
  176. H#: 65104 S12/SPECTRA Publishing
  177.     11-Sep-90  07:50:14
  178. Sb: #65093-Peace and Quiet !
  179. Fm: Bob Zale: PowerBASIC R&D 76304,1303
  180. To: Mason Landstreet 71220,1547
  181.  
  182. We'll have a formal announcement of PowerBASIC #2.10 very shortly.  Just stay
  183. tuned a couple of days, Mason.  Thanks for your interest!
  184.   Bob Zale (PowerBASIC R&D)
  185.  
  186. Press <CR> for next or type CHOICES !
  187. H#: 65096 S12/SPECTRA Publishing
  188.     11-Sep-90  06:55:57
  189. Sb: #64661-#Peace and Quiet !
  190. Fm: Mason Landstreet 71220,1547
  191. To: Bob Zale: PowerBASIC R&D 76304,1303 (X)
  192.  
  193. Bob,
  194.  
  195. How long do you think it will be before mandatory use of the CALL keyword for
  196. accessing uer defined functions will be done away with?
  197.  
  198. Mason
  199.  
  200. There is 1 Reply.
  201.  
  202. Press <CR> for next or type CHOICES !
  203. H#: 65105 S12/SPECTRA Publishing
  204.     11-Sep-90  07:51:30
  205. Sb: #65096-Peace and Quiet !
  206. Fm: Bob Zale: PowerBASIC R&D 76304,1303
  207. To: Mason Landstreet 71220,1547
  208.  
  209. An optional "CALL" keyword is destined for the next major version of PB.
  210.   Bob
  211.  
  212. Press <CR> for next or type CHOICES !
  213. H#: 65099 S12/SPECTRA Publishing
  214.     11-Sep-90  07:18:18
  215. Sb: #Structures
  216. Fm: Mason Landstreet 71220,1547
  217. To: Bob Zale
  218.  
  219. Bob,
  220.  
  221. How about real structures so we can do away with CVI, CVS, CVL, CVD,  MKI$,
  222. MKS$, MKL$, MKD$. Before you answer this let me look at FLEXSTRINGS one more
  223. time. If FLEXSTRINGS will let me push numeric variables into them without the
  224. conversions or if there is another method  I have missed it. If FLEXSTRINGS
  225. won't do this go ahead and answer.
  226.  
  227. Thanks...........................................Mason
  228.  
  229. There is 1 Reply.
  230.  
  231. Press <CR> for next or type CHOICES !
  232. H#: 65101 S12/SPECTRA Publishing
  233.     11-Sep-90  07:43:34
  234. Sb: #65099-Structures
  235. Fm: Bob Zale: PowerBASIC R&D 76304,1303
  236. To: Mason Landstreet 71220,1547
  237.  
  238. Mason --
  239.   MAPping flex strings still require conversion functions.  The big advantage
  240. is the fact it's dynamic.  The size and content of the structure may be
  241. determined at run-time, not compile-time.  Yes, it would be more convenient to
  242. allow direct numeric access.  It's very high on our list.
  243.   Bob Zale (PowerBASIC R&D)
  244.  
  245. Press <CR> for next or type CHOICES !
  246. HPC Vendor B ForumHSections Menu
  247.  
  248. Section names (#subjs/# msgs)
  249.  1 Quarterdeck  (54/112)
  250.  2 Primavera Systems  (1/1)
  251.  3 Korenthal Assocs.  (2/3)
  252.  4 Personics Corp.  (13/34)
  253.  5 Quicksoft  (3/4)
  254.  6 TurboPower Software  (39/85)
  255.  8 DacEasy  (6/7)
  256. 10 J.P. Software  (16/46)
  257. 11 PDC Prolog  (5/10)
  258. 12 SPECTRA Publishing  (2/12)
  259. HEnter choice(s) or ALL !