Announcement

Collapse
No announcement yet.

RETAIN$() Crashes program (PBCC 4.04).

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RETAIN$() Crashes program (PBCC 4.04).

    I tried looking for someone else having a similar problem, but I didn't find anything. Eitherway the code below crashes when run (compiled in PBCC 4.04), any Ideas? Does it happen to anyone else?

    Code:
    #COMPILE EXE
    #DIM ALL
    
    FUNCTION PBMAIN () AS LONG
       
       DIM myInput AS STRING
       
       myInput = RETAIN$("asd", ANY "0123456789")
    
       PRINT myInput
       
       SLEEP 1000
    
    END FUNCTION
    P.S. This is just simplified code but still generates error, my original code is a choice program for use with batch files where it displays a list and you can input a number to make a selection, however if no number is entered or if non-numeric text is entered it crashes. However, if you have non-numeric characters mixed with numbers it wont crash. As far as I know if RETAIN$() does not find anything its supposed to return an empty string, but instead it crashes for me.

  • #2
    Edit: No true GPF (message) but it does abort without the PRINT

    James
    Last edited by jcfuller; 4 Aug 2008, 03:07 PM.

    Comment


    • #3
      This is the Error Signature that windows provides when it crashes.

      AppName: wait.exe AppVer: 0.0.0.0 ModName: wait.exe
      ModVer: 0.0.0.0 Offset: 00001b61

      I'm also running on Windows XP SP2. Odd thing is it works just fine using PBWin 8.04, maybe I'll just have to make it a windows program instead of a console program.

      Comment


      • #4
        It GPFs for me too. If I replace SLEEP with WAITKEY$ it is okay.

        Comment


        • #5
          I confirm too. Problem is in SLEEP. Following code works fine:
          Code:
            #Compile Exe
            #Dim All
          
            Function PBMain () As Long
             
              Dim myInput As String
             
              myInput = Retain$("asd", Any "0123456789")
          
              Print "Error: " & Str$(ErrClear)
              Print "[" & myInput & "]"
             
              Print "All done."
           
              waitkey$
          
            End Function
          Last edited by Eros Olmi; 5 Aug 2008, 11:01 AM.
          thinBasic programming language
          Win10 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

          Comment


          • #6
            Did some testing myself.

            If the return string is nul, it errors out. If the return string contains something, it runs as advertised. Both times with the SLEEP x.

            For the life of me, I can't figure out why.

            Maybe you should drop support a line. Maybe they can tell you what's going on.
            There are no atheists in a fox hole or the morning of a math test.
            If my flag offends you, I'll help you pack.

            Comment


            • #7
              Maybe you should drop support a line. Maybe they can tell you what's going on.

              Maybe they will put it on the "to be fixed" list while they are at it.

              The workaround is pretty obvious.. don't PRINT a NULL string.

              Or maybe, don't use the RETAIN$ unless VALIDATE(targetstring, "0123456789") is true. (You don't need it when false, since target string will contain only numbers).

              While you're at it, don't bother with anything if the targetstring is null.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment

              Working...
              X