No announcement yet.

RETAIN$() Crashes program (PBCC 4.04).

  • 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?

    #DIM ALL
       DIM myInput AS STRING
       myInput = RETAIN$("asd", ANY "0123456789")
       PRINT myInput
       SLEEP 1000
    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

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


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

      AppName: wait.exe AppVer: ModName: wait.exe
      ModVer: 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.


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


        • #5
          I confirm too. Problem is in SLEEP. Following code works fine:
            #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."
            End Function
          Last edited by Eros Olmi; 5 Aug 2008, 12:01 PM.


          • #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.


            • #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]