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

  1. all
  2. H#: 54813 S12/SPECTRA Publishing
  3.     02-Jul-90  20:34:19
  4. Sb: #54681-DIM errors
  5. Fm: Dan Robins 70007,3264
  6. To: Bob Zale: PowerBASIC R&D 76304,1303 (X)
  7.  
  8. Bob,
  9.   Have you experienced anyone else mentioning certain string arrays (of the
  10. non-flex variety) being replaced by chr$(32) when performing an ARRAY DELETE
  11. command?
  12.   Read strange. Early in a program I do READ statements to find out the
  13. filename & record size, dependent upon a menu selection, ie:
  14.   SELECT CASE menuselect%
  15.          CASE 1
  16.            RESTORE CustomerDat
  17.          CASE 2
  18.            RESTORE ProductDat
  19.          CASE 3
  20.            RESTORE InvoiceDat
  21.    END SELECT
  22.  READ filename$:READ filelength%
  23.  RETURN
  24.  'at the bottom of the program are the Data statements
  25.  CustomerDat:
  26.  DATA "CUSTOMER.DAT",206
  27.  ProductDat:
  28.  DATA "PRODUCT.DAT",188
  29.  InvoiceDat:
  30.  DATA "INVOICE.DAT",160
  31.  
  32.  Rather simple, however, when I do an ARRAY DELETE on a completely different
  33. flexstring array, using the WATCH window, I watch filename$ go from
  34. ~CUSTOMER.DAT" to "            " (notice, that the same number of characters,
  35. but the ascii characters are gone).
  36.   Figure that one out!   <grin>
  37.  
  38.   Dan
  39.  
  40. Press <CR> for next or type CHOICES !
  41. H#: 54714 S12/SPECTRA Publishing
  42.     02-Jul-90  11:16:35
  43. Sb: #ERR 62 / input past end
  44. Fm: Eric Pearson 71641,717
  45. To: [F] Spectra 75300,214 (X)
  46.  
  47.  Using the following code...
  48.  
  49.  OPEN "TESTFILE" FOR INPUT AS #1
  50.  WHILE NOT EOF(1)
  51.        OneChar$ = INPUT$(1,#1)
  52.  WEND
  53.  CLOSE
  54.  
  55.  ... I'm getting ERR 62 on the input$.  It seems to be related to file length;
  56. a file with length 257 always crashes, but add a character and it runs ok.
  57. (257= 2^8 +1?).  The files contain one long string (ascii => 32), ending with a
  58. CR/LF.
  59.  
  60.  One of my customers is reporting a problem with a file of length 897 but I
  61. haven't tried it.  Incid: PB _and_ TB both give the same error.
  62.  
  63.  -- Eric P.
  64.  
  65. There is 1 Reply.
  66.  
  67. Press <CR> for next or type CHOICES !
  68. H#: 54778 S12/SPECTRA Publishing
  69.     02-Jul-90  16:57:52
  70. Sb: #54714-#ERR 62 / input past end
  71. Fm: Barry Erick for Spectra 75300,214
  72. To: Eric Pearson 71641,717 (X)
  73.  
  74. Eric,
  75.  I ran this with no problem, using a file of 257 characters:
  76.   OPEN "Testfile" for output as #2
  77.  for x = 1 to 257
  78.  print #2,"a";
  79.  next
  80.  close  2
  81.  open "Testfile" for input as #1
  82.  
  83.  while not eof(1)
  84.  foo$ = foo$+input$(1,1)
  85.  loop
  86.  close 1
  87.  print len(foo$)
  88.  
  89.  No problem with this, and I use a similar routine in a comm program that
  90. varies on the size of the input file depending on the file sixe being saved or
  91. written with no problems. I suspect this is related to some other code.
  92.  --- Barry
  93.  
  94.  
  95.  
  96.  
  97. There is 1 Reply.
  98.  
  99. Press <CR> for next or type CHOICES !
  100. H#: 54847 S12/SPECTRA Publishing
  101.     03-Jul-90  03:20:20
  102. Sb: #54778-#ERR 62 / input past end
  103. Fm: Eric Pearson 71641,717
  104. To: Barry Erick for Spectra 75300,214 (X)
  105.  
  106.  Barry --
  107.  
  108.  The data files that I'm dealing with start out as text + CR/LF, and dos
  109. appends CtrlZ when the file is copied into my data directory.  Try this...
  110.  
  111.  OPEN "TestFile" FOR OUTPUT AS #2
  112.  FOR X% = 1 TO 256
  113.      PRINT #2,"Q";
  114.  NEXT
  115.  PRINT #2,CHR$(26);
  116.  CLOSE #2
  117.  
  118.  OPEN "TestFile" FOR INPUT AS #1
  119.  WHILE NOT EOF(1)
  120.        OneChar$ = INPUT$(1,#1)
  121.  WEND
  122.  CLOSE #1
  123.  
  124.  I assume it's the CtrlZ that's causing the problem, but the weird part is that
  125. the code works fine MOST of the time, but it crashes if the file happens to be
  126. just the right length.   Replace the 256 with any multiple of 128 and the
  127. program will crash; other numbers work fine.
  128.  
  129.  -- Eric P.
  130.  
  131. There is 1 Reply.
  132.  
  133. Press <CR> for next or type CHOICES !
  134. H#: 54852 S12/SPECTRA Publishing
  135.     03-Jul-90  05:00:41
  136. Sb: #54847-ERR 62 / input past end
  137. Fm: Barry Erick for Spectra 75300,214
  138. To: Eric Pearson 71641,717
  139.  
  140. Eric,
  141.  Your problem is you are using a text input routine and that can't be used to
  142. bring in a eof marker. Use the Binary file mode if you must receive any
  143. character and then GET$(1,1,OneChar$). That is what I use (not input$) in my
  144. programs. I missed on that at first, but the ctrl z did it. :
  145.   Open "Testfile" for binary as #2
  146.   for x = 1 to 256
  147.     put$ 2,"Q"
  148.   next
  149.   put$ 2, chr$(26)
  150.   close 2
  151.   open "TestFile" for binary as #1
  152.   do until eof(1)
  153.     get$(1,1,OneChar$)
  154.   loop
  155.   close 1
  156.  
  157.   That is what Binary file mode is for.... every and all characters, not just
  158. text.
  159.       --- Barry
  160.  
  161.  
  162.  
  163. Press <CR> for next or type CHOICES !
  164. H#: 54807 S12/SPECTRA Publishing
  165.     02-Jul-90  20:13:24
  166. Sb: SHIFT PROBLEM
  167. Fm: Kevin Johnson 72271,1764
  168. To: [F] Bob Zale 76304,1303 (X)
  169.  
  170. Bob,
  171.      I have been using Turbo Basic for a few years now and upgraded to Power
  172. Basic just recently.  I have written a Shop Floor Tracking Program utilizing 6
  173. (six) Austin 386sx, 4 (four) Northgate  (2)386-33, (1)386-25, (1)286-12.5, and
  174. 2 PS/2 Model 50z.  I have been experiencing a SHIFT state problem on 2 (two)
  175. Austins (PHONIX 1.10.04 BIOS). It appears as if someone is holding down the
  176. shift key at random (i.e.  > instead of .)  This only occurs on the two Phoenix
  177. Bios machines (the other Austins are Quatel Bios and the Northgates are AMI). 
  178. Austin Tech Support is telling me that it is a possiblity that my program (1st
  179. experienced on TURBO BASIC, then continued with the POWER BASIC upgrade.) is
  180. messing with address 751 & 752 which contain the shift state information (I am
  181. guessing the addresses, I left them at work).  I told them that I am not
  182. directly pokeing or peeking in those address ranges.
  183.  
  184. Do you have any ideas other than don't buy Austins with Phoenix Bios.
  185.  
  186. P.S. I am also running Novell Advanced Netware v2.15.
  187.                               Thanks      Kevin
  188.  
  189. H#: 54908 S12/SPECTRA Publishing
  190.     03-Jul-90  10:51:07
  191. Sb: #54852-ERR 62 / input past end
  192. Fm: Eric Pearson 71641,717
  193. To: Barry Erick for Spectra 75300,214
  194.  
  195.   Thanks Barry...  So INPUT$ can only be used on files that have not been
  196. _copied_ by DOS, even if they contain only text.  Interesting!  I'm still
  197. intrigued by the fact that it works unless the file length is a multiple of
  198. 128. Oh well...
  199.  
  200. -- Eric P.
  201.  
  202. Press <CR> for next or type CHOICES !
  203. H#: 54922 S12/SPECTRA Publishing
  204.     03-Jul-90  13:02:23
  205. Sb: #ARRAY CORRUPT
  206. Fm: John Gessner 71131,3256
  207. To: ANYONE
  208.  
  209. SCREEN                  12 Defint                  a-z %LightCounterColor     
  210. = 15 %DarkCounterColor       = 12 %BoxEdgeColor           = 9 %BoxBottomColor
  211. = 1 %DarkTriangleColor      = 6 %LightTriangleColor     = 7 %ForGroundPrint
  212. = 14 %BackGround             = 14
  213.  
  214. DIM             DYNAMIC Uptriangles(2728),DnTriangles(2728),GetBoard(29921) CLS
  215.  
  216.              'Draw Bottom Triangles LINE            (64 , 360)-(144 , 228) ,
  217. %BoxBottomColor , BF 'Background LINE            (66 , 360)-(84 , 228)  ,
  218. %DarkTriangleColor 'Draw it LINE            (84 , 228)-(102 , 360) ,
  219. %DarkTriangleColor LINE            (102 , 360)-(66 , 360) , %DarkTriangleColor
  220. PAINT           (84 , 350), %DarkTriangleColor , %DarkTriangleColor 'Color it
  221. LINE            (106 , 360)-(124 , 228) , %LightTriangleColor 'Draw it LINE
  222. (124 , 228)-(142 , 360) , %LightTriangleColor LINE            (142 , 360)-(106
  223. , 360) , %LightTriangleColor PAINT           (125 , 350), %LightTriangleColor ,
  224. %LightTriangleColor 'Color it GET             (64  , 228)-(144 , 360), 
  225. Uptriangles 'Get both triangles PUT             (64  , 228) , Uptriangles
  226. 'Erase
  227.       ' Draw Top Triangles LINE            (64 ,  13)-(144 , 145) ,
  228. %BoxBottomColor , BF 'Background LINE            (66 ,  13)-(84 ,  145) , 
  229. %LightTriangleColor 'Draw it LINE            (84 , 145)-(102 , 13)  ,
  230. %LightTriangleColor LINE            (102 , 13)-(66 ,  13) , 
  231. %LightTriangleColor PAINT           (84 , 30) , %LightTriangleColor ,
  232. %LightTriangleColor 'Color It LINE            (106 , 13)-(124 , 145) ,
  233. %DarkTriangleColor 'Draw it LINE            (124 , 145)-(142 , 13) ,
  234. %DarkTriangleColor LINE            (142 , 13)-(106 , 13) , %DarkTriangleColor
  235. PAINT           (110 , 15) , %DarkTriangleColor , %DarkTriangleColor 'Color it
  236.       '*********** TEST FOR INTEGRITY OF ARRAY "Uptriangles" ***********
  237.   LOCATE 10 ,38 : PRINT "The ARRAY Uptriangles"
  238.   PUT (300,0),Uptriangles  'THE ARRAY Uptriangles is fine here
  239.   LOCATE 11,38 : PRINT "Before GET"
  240.   GET           (64 , 13)-(144 , 145) , Dntriangles 'Get new array
  241.   LOCATE  10 , 9 : PRINT "The GET"
  242.   PUT (400,0),Uptriangles ' NOW THE ARRAY IS CORRUPTED
  243.   LOCATE 11,52 : PRINT "After GET" u$ = INPUT$(1) END    '********** ENDS TEST
  244. OF "Uptriangles ************** PUT             (64 , 13) , Dntriangles
  245.                        'Draw the box LINE            (0,0)   -(639,3A(X
  246.  
  247. There is 1 Reply.
  248.  
  249. Press <CR> for next or type CHOICES !
  250. H#: 54927 S12/SPECTRA Publishing
  251.     03-Jul-90  13:52:11
  252. Sb: #54922-#ARRAY CORRUPT
  253. Fm: John Gessner 71131,3256
  254. To: John Gessner 71131,3256 (X)
  255.  
  256. Wow!  What happend to my program (above message).  It is a simple program
  257. straight from the PB editor.  I used Ymodem to upload it. What did I do wrong? 
  258. Anyway it demonstrates the following: I am drawing a backgammon board in screen
  259. 12.  I use put and get in the process two arrays. When I GET the second array,
  260. the first array is corrupted.  When I PUT it again it's screwed up.  I can't
  261. figure out what's wrong. Help? If anyone can tell me what I did wrong in
  262. uploading, I'll upload again.
  263.  
  264. There is 1 Reply.
  265.  
  266. Press <CR> for next or type CHOICES !
  267. H#: 54936 S12/SPECTRA Publishing
  268.     03-Jul-90  15:22:52
  269. Sb: #54927-ARRAY CORRUPT
  270. Fm: Bob Zale: PowerBASIC R&D 76304,1303
  271. To: John Gessner 71131,3256 (X)
  272.  
  273. John --
  274.   The upload problem is that the forum software wraps lines to conserve space. 
  275. To keep your format intact, you need to insert one or more spaces at the start
  276. of each line.  I'm going to look at the file as-is and see what we can find,
  277. but if you try again, we might be more certain of the file integrity/accuracy. 
  278. Thanks!
  279.   Bob Zale (PowerBASIC R&D)
  280.  
  281. Press <CR> for next or type CHOICES !
  282. H#: 54959 S12/SPECTRA Publishing
  283.     03-Jul-90  17:08:29
  284. Sb: new array corrupt
  285. Fm: John Gessner 71131,3256
  286. To: all
  287.  
  288.   SCREEN                        12
  289.   Defint                        a-z
  290.   %LightCounterColor    = 15
  291.   %DarkCounterColor     = 12
  292.   %BoxEdgeColor         = 9
  293.   %BoxBottomColor       = 1
  294.   %DarkTriangleColor    = 6
  295.   %LightTriangleColor   = 7
  296.   %ForGroundPrint       = 14
  297.   %BackGround           = 14
  298.  
  299.   DIM           DYNAMIC Uptriangles(2728),DnTriangles(2728),GetBoard(29921)
  300.   CLS
  301.  
  302.              'Draw Bottom Triangles
  303.   LINE          (64 , 360)-(144 , 228) , %BoxBottomColor , BF 'Background
  304.   LINE          (66 , 360)-(84 , 228)  , %DarkTriangleColor 'Draw it
  305.   LINE          (84 , 228)-(102 , 360) , %DarkTriangleColor
  306.   LINE          (102 , 360)-(66 , 360) , %DarkTriangleColor
  307.   PAINT         (84 , 350), %DarkTriangleColor , %DarkTriangleColor 'Color it
  308.   LINE          (106 , 360)-(124 , 228) , %LightTriangleColor 'Draw it
  309.   LINE          (124 , 228)-(142 , 360) , %LightTriangleColor
  310.   LINE          (142 , 360)-(106 , 360) , %LightTriangleColor
  311.   PAINT                 (125 , 350), %LightTriangleColor , %LightTriangleColor
  312.   GET           (64  , 228)-(144 , 360),  Uptriangles 'Get both triangles
  313.   PUT           (64  , 228) , Uptriangles             'Erase
  314.         ' Draw Top Triangles
  315.   LINE            (64 ,  13)-(144 , 145) , %BoxBottomColor , BF 'Background
  316.   LINE          (66 ,  13)-(84 ,  145) ,  %LightTriangleColor 'Draw it
  317.   LINE          (84 , 145)-(102 , 13)  , %LightTriangleColor
  318.   LINE          (102 , 13)-(66 ,  13) ,  %LightTriangleColor
  319.   PAINT         (84 , 30) , %LightTriangleColor , %LightTriangleColor
  320.   LINE          (106 , 13)-(124 , 145) , %DarkTriangleColor 'Draw it
  321.   LINE          (124 , 145)-(142 , 13) , %DarkTriangleColor
  322.   LINE          (142 , 13)-(106 , 13) , %DarkTriangleColor
  323.   PAINT         (110 , 15) , %DarkTriangleColor , %DarkTriangleColor
  324.         '*********** TEST FOR INTEGRITY OF ARRAY "Uptriangles" ***********
  325.     LOCATE 10 ,38 : PRINT "The ARRAY Uptriangles"
  326.     PUT (300,0),Uptriangles  'THE ARRAY Uptriangles is fine here
  327.     LOCATE 11,38 : PRINT "Before GET"
  328.     GET                 (64 , 13)-(144 , 145) , Dntriangles 'Get new array
  329.     LOCATE  10 , 9 : PRINT "The GET"
  330.     PUT (400,0),Uptriangles ' NOW THE ARRAY IS CORRUPTED
  331.     LOCATE 11,52 : PRINT "After GET"
  332.   u$ = INPUT$(1)
  333.   END    '********** ENDS TEST OF "Uptriangles **************
  334.   PUT             (64 , 13) , DntrA(Xi
  335.  
  336.