Announcement

Collapse
No announcement yet.

How do you get rid of ERROR 496?

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

  • How do you get rid of ERROR 496?

    My compile wont over ride the old *.EXE file, and it is getting me very upset!!!!
    If I erase the old .exe file, then my program works ok.
    I am getting tired of deleting the old exe file so that I can re-run the program.
    I have searched for a solution but to no avail.
    Thanks for any help.

    ps: Everything was fine then error 496 showed up. I have run my code thru a stripper program that I wrote to get rid of any 'odd' characters, but still no help.
    Bruce Bachelder has posted the same problem but no solution for me.
    Thanks all, Mr Lynn Wakefield

  • #2
    Bring up task manager and see if your program is still rattling around in memory someplace. If so "end task" will take care of it.
    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


    • #3
      > I have run my code thru a stripper program that I wrote to get rid of any 'odd' >characters, but still no help.

      That can't help, because the problem is not at the source code level....
      496 Destination file write error - During compilation the compiler received a disk write error.
      This can occur if the destination EXE is, for example, still running in memory when you attempt to compile, the target file is write locked by another process or compile session, or the target file is write-protected (read-only).
      Either the program is still running (bad code logic, not bad code characters in the source code) or some other program has opened the EXE for exclusive use.

      Check your end of job logic, you may have left something running which just doesn't have any visible manifestation.

      (could also occur on 'directory full' but I think that can only happen on root directories; or if you have a "#COMPILE EXE filename" directive and filename contains invalid characters or an invalid path. )
      Michael Mattias
      Tal Systems Inc. (retired)
      Racine WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        How do you get rid of ERROR 496?

        This code will give you all the possibilities of each number 1-9 for the puzzle: use at your own risk.
        Code:
        Code:
        #COMPILE EXE      '-------------------------------------- Sudoku_Console.bas
        #DIM ALL
        GLOBAL c,r,x,y,w,z,Flag AS LONG
        GLOBAL PossNumToPrint AS INTEGER
        GLOBAL BoxNum(),i AS STRING
        GLOBAL PossFinal() AS STRING
        GLOBAL Block(),Col(),Row() AS LONG
        DECLARE SUB Main_Program
        DECLARE SUB Print_main_box
        DECLARE SUB Print_Top_Boxes
        DECLARE SUB Print_Bot_Boxes
        DECLARE SUB Put_Box_Number
        DECLARE SUB Print_Sudoku_Box
        DECLARE SUB Load_Sudoku
        DECLARE SUB Save_Sudoku
        DECLARE SUB Sound_Beep_Beep_Beep
        DECLARE SUB Check_Possibilities
        
        FUNCTION PBMAIN AS LONG
            DIM BoxNum(1 TO 81) AS GLOBAL STRING
            DIM PossFinal(1 TO 81) AS GLOBAL STRING
            CONSOLE SET LOC 1,1
            CONSOLE SET SCREEN 58,126
            CONSOLE SET FOCUS
            'COLOR 0,7  'Off white
            COLOR 0,15  'white
            CLS
            Print_Top_Boxes
            Print_Bot_Boxes
            Print_main_box
            Main_Program
        END FUNCTION
        
        SUB Print_Sudoku_Box
            Sound_Beep_Beep_Beep
            'XPRINT ATTACH "PrimoPDF"
            'XPRINT ATTACH choose
            XPRINT ATTACH DEFAULT
            XPRINT WIDTH 9
            'xprint line (col,row) - (col,row)
            XPRINT BOX (1300,1800) - (3700,4200)  '800 X 800 Pix's
            XPRINT LINE (1300,2600) - (3700,2600) 'horiz line 3
            XPRINT LINE (1300,3400) - (3700,3400) 'horiz line 6
            XPRINT LINE (2100,1800) - (2100,4200) 'vert line 3
            XPRINT LINE (2900,1800) - (2900,4200) 'vert line 6
            XPRINT WIDTH 2
            XPRINT LINE (1300,2067) - (3700,2067) 'horiz line 1
            XPRINT LINE (1300,2334) - (3700,2334) 'horiz line 2
            XPRINT LINE (1300,2868) - (3700,2868) 'horiz line 4
            XPRINT LINE (1300,3135) - (3700,3135) 'horiz line 5
            XPRINT LINE (1300,3669) - (3700,3669) 'horiz line 7
            XPRINT LINE (1300,3936) - (3700,3936) 'horiz line 8
            XPRINT LINE (1567,1800) - (1567,4200) 'vert line 1
            XPRINT LINE (1834,1800) - (1834,4200) 'vert line 2
            XPRINT LINE (2368,1800) - (2368,4200) 'vert line 4
            XPRINT LINE (2635,1800) - (2635,4200) 'vert line 5
            XPRINT LINE (3169,1800) - (3169,4200) 'vert line 7
            XPRINT LINE (3436,1800) - (3436,4200) 'vert line 8
            XPRINT FONT "New Courier",18,0        ',1 = bold
            y = 0 : r = 0
            FOR z = 0 TO 72 STEP 9
                FOR c = 1 TO 9
                    y = y + 265
                    XPRINT SET POS (1100 + y, 1860 + r)
                    IF Flag THEN XPRINT PossFinal(z+c) ELSE XPRINT BoxNum(z + c)
                NEXT c
                r = r + 265 : y = 0
            NEXT z
            XPRINT CLOSE
        END SUB
        
        SUB Main_Program '=============================================================== Main_Program
            LOCAL Box_Num,Box_Main,Spot_y,Spot_x AS LONG
            DIM Block(1 TO 9),Col(1 TO 9),Row(1 TO 9) AS GLOBAL LONG
            LOCATE 1,1 : x = 1
            FOR z = 1 TO 81 : BoxNum(z) = "" : NEXT z  '------- Set BoxNum() array to ""
            DO       '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  DO
                Flag = 0   '----- Print BoxNum()    1 = PossFinal()
                MOUSE ON
                MOUSE 3,DOUBLE,DOWN
                PossNumToPrint = 0
                'locate x,1                                              '-----------------------------
                'incr x                                                  'Show location of mouse clicks
                '                                                        'Along Left side of screen
                'print mousey;",";mousex    'MOUSEY = ROW   MOUSEX = COL '-----------------------------
                i = WAITKEY$
            z = 0                     '----------------------------------------- Get box number to set
            FOR w = 16 TO 104 STEP 11
                INCR z
                IF MOUSEY >= 6 AND MOUSEY <= 10 AND MOUSEX >= w AND MOUSEX <= w+6 THEN Box_Num = z : _
                EXIT FOR
                IF MOUSEY >= 50 AND MOUSEY <= 54 AND MOUSEX >= w AND MOUSEX <= w+6 THEN _
                    PossNumToPrint = z : EXIT FOR
            NEXT w
        
            '------------------------------------------------------------------------ Set Erase Button
            IF MOUSEY >=1 AND MOUSEY <=5 AND MOUSEX >= 60 AND MOUSEX <= 66 THEN Box_Num = 10
            '--------------------------------------------------------------------- Erase Number on Grid
            IF Box_Num = 10 THEN : LOCATE 15,58 : PRINT "Number = Erase";
            '-------------------------------------------------------------------------------- Load File
            IF MOUSEY >=1 AND MOUSEY <=5 AND MOUSEX >= 16 AND MOUSEX <= 22 THEN Load_Sudoku
            '-------------------------------------------------------------------------------- Save File
            IF MOUSEY >=1 AND MOUSEY <=5 AND MOUSEX >= 104 AND MOUSEX <= 110 THEN Save_Sudoku
            '------------------------------------------------------------- Print Sudoku Grid to Printer
            IF UCASE$(i) = "P" THEN Flag = 0 : Print_Sudoku_Box : Flag = 1 : LOCATE 57,81
            '------------------------------------------------------------------- Print a number to Grid
            IF Box_Num > 0 AND Box_Num < 10 THEN LOCATE 15,58 :_
            PRINT "Number =";Box_Num;"      " ELSE LOCATE 15,58 : PRINT "                  ";
            '------------------------------------------ Get Box_Main Number & location to print on grid
            z = 0 : Box_Main = 0
            IF Box_Num > 0 AND Box_Num < 11 THEN
                FOR w = 17 TO 41 STEP 3  'ROW
                    FOR y = 36 TO 84 STEP 6  'COL
                        INCR z
                        IF MOUSEY >= w AND MOUSEY <= w+3 AND MOUSEX >= y AND MOUSEX <= y+6 THEN _
                         Spot_y = y + 2 : Spot_x = w + 1 : Box_Main = z : BoxNum(Box_Main) = STR$(z) : _
                         EXIT FOR
                    NEXT y                 'Spot_y = ROW   Spot_x = Col
                NEXT w
            END IF
        
            '--------------------------------------------------------------------------------- Erase Box
            IF Box_Num =10 AND Box_Main > 0 THEN LOCATE Spot_x,Spot_y:PRINT "  " : BoxNum(Box_Main) = ""
        
            IF Box_Main > 0  THEN LOCATE 45,54 : PRINT "Box Number =";Box_Main; ELSE _ '----- Box Number
                LOCATE 45,54 : PRINT "                 ";
            IF PossNumToPrint >0 THEN LOCATE 47,50 : PRINT "Possibility to Print =";PossNumToPrint; _
                ELSE LOCATE 47,50 : PRINT "                               ";
            IF Box_Num > 0 AND Box_Num <10 THEN IF Box_Main > 0 THEN IF MOUSEY >=17_
             AND MOUSEY <=44 AND MOUSEX >= 36 AND MOUSEX <=90 THEN LOCATE Spot_x,Spot_y:PRINT Box_Num;:_
               BoxNum(Box_Main) = STR$(Box_Num)
                         '--------set flag to 1 to print PossFinal() or 0 to Print Print_Sudoku_Box
            IF PossNumToPrint >0 THEN Check_Possibilities : Flag = 1 : Print_Sudoku_Box
            LOOP UNTIL i = $ESC    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LOOP
        END SUB       '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\  End Program
         
        SUB Check_Possibilities
            FOR z = 1 TO 9
                Block(z) = 0 : Row(z) = 0 :Col(z) = 0
            NEXT z
            FOR z = 1 TO 81  '---------------------------- Set PossFinal() to PossNumToPrint
                PossFinal(z) = TRIM$(STR$(PossNumToPrint))
            NEXT z
            FOR z = 1 TO 81
                IF VAL(BoxNum(z)) = PossNumToPrint THEN PossFinal(z) = "$"
                IF VAL(BoxNum(z)) >0 AND VAL(BoxNum(z)) <> PossNumToPrint THEN PossFinal(z) = ""
            NEXT z
            FOR z = 1 TO 81 '------------------------------------------ Set Block & Row Numbers
                 IF PossFinal(z) = "$" THEN
                    IF z >= 1 AND z =< 3  THEN Block(1) = 1 : Row(1) = 1
                    IF z >= 4 AND z =< 6  THEN Block(2) = 2 : Row(1) = 1
                    IF z >= 7 AND z =< 9  THEN Block(3) = 3 : Row(1) = 1
                    IF z >= 10 AND z =< 12 THEN Block(1) = 1 : Row(2) = 2
                    IF z >= 13 AND z =< 15 THEN Block(2) = 2 : Row(2) = 2
                    IF z >= 16 AND z =< 18  THEN Block(3) = 3 : Row(2) = 2
                    IF z >= 19 AND z =< 21 THEN Block(1) = 1 : Row(3) = 3
                    IF z >= 22 AND z =< 24 THEN Block(2) = 2 : Row(3) = 3
                    IF z >= 25 AND z =< 27  THEN Block(3) = 3 : Row(3) = 3
                    IF z >= 28 AND z =< 30 THEN Block(4) = 4 : Row(4) = 4
                    IF z >= 31 AND z =< 33 THEN Block(5) = 5 : Row(4) = 4
                    IF z >= 34 AND z =< 36  THEN Block(6) = 6 : Row(4) = 4
                    IF z >= 37 AND z =< 39 THEN Block(4) = 4 : Row(5) = 5
                    IF z >= 40 AND z =< 42 THEN Block(5) = 5 : Row(5) = 5
                    IF z >= 43 AND z =< 45  THEN Block(6) = 6 : Row(5) = 5
        
                    IF z >= 46 AND z =< 48 THEN Block(4) = 4 : Row(6) = 6
                    IF z >= 49 AND z =< 51 THEN Block(5) = 5 : Row(6) = 6
                    IF z >= 52 AND z =< 54  THEN Block(6) = 6 : Row(6) = 6
        
                    IF z >= 55 AND z =< 57 THEN Block(7) = 7 : Row(7) = 7
                    IF z >= 58 AND z =< 60 THEN Block(8) = 8 : Row(7) = 7
                    IF z >= 61 AND z =< 63  THEN Block(9) = 9 : Row(7) = 7
                    IF z >= 64 AND z =< 66 THEN Block(7) = 7 : Row(8) = 8
                    IF z >= 67 AND z =< 69 THEN Block(8) = 8 : Row(8) = 8
                    IF z >= 70 AND z =< 72  THEN Block(9) = 9 : Row(8) = 8
        
                    IF z >= 73 AND z =< 75 THEN Block(7) = 7 : Row(9) = 9
                    IF z >= 76 AND z =< 78 THEN Block(8) = 8 : Row(9) = 9
                    IF z >= 79 AND z =< 81  THEN Block(9) = 9 : Row(9) = 9
                END IF
            NEXT z
             y = 0  '------------------------------------------ Set Column Numbers
            FOR z = 1 TO 9
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z
            NEXT z
            y = 0
            FOR z = 10 TO 18
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z - 9
            NEXT z
            y = 0
            FOR z = 19 TO 27
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z - 18
            NEXT z
            y = 0
            FOR z = 28 TO 36
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z - 27
            NEXT z
            y = 0
            FOR z = 37 TO 45
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z - 36
            NEXT z
            y = 0
            FOR z = 46 TO 54
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z - 45
            NEXT z
            y = 0
            FOR z = 55 TO 63
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z - 54
            NEXT z
            y = 0
            FOR z = 64 TO 72
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z - 63
            NEXT z
            y = 0
            FOR z = 73 TO 81
                INCR y
                IF PossFinal(z) = "$" THEN Col(y) = z - 72
            NEXT z
            FOR z = 1 TO 9        '------------------------------------------ Set Blocks to ""
                    IF Block(z) = 1 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                            IF PossFinal(w+9) <>"$" THEN PossFinal(w+9) = ""
                            IF PossFinal(w+18) <>"$" THEN PossFinal(w+18) = ""
                    NEXT w
                    END IF
                    IF Block(z) = 2 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w+3) <>"$" THEN PossFinal(w+3) = ""
                            IF PossFinal(w+12) <>"$" THEN PossFinal(w+12) = ""
                            IF PossFinal(w+21) <>"$" THEN PossFinal(w+21) = ""
                        NEXT w
                    END IF
                    IF Block(z) = 3 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w+6) <>"$" THEN PossFinal(w+6) = ""
                            IF PossFinal(w+15) <>"$" THEN PossFinal(w+15) = ""
                            IF PossFinal(w+24) <>"$" THEN PossFinal(w+24) = ""
                        NEXT w
                    END IF
                    IF Block(z) = 4 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w+27) <>"$" THEN PossFinal(w+27) = ""
                            IF PossFinal(w+36) <>"$" THEN PossFinal(w+36) = ""
                            IF PossFinal(w+45) <>"$" THEN PossFinal(w+45) = ""
                        NEXT w
                    END IF
                    IF Block(z) = 5 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w+30) <>"$" THEN PossFinal(w+30) = ""
                            IF PossFinal(w+39) <>"$" THEN PossFinal(w+39) = ""
                            IF PossFinal(w+48) <>"$" THEN PossFinal(w+48) = ""
                        NEXT w
                    END IF
                    IF Block(z) = 6 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w+33) <>"$" THEN PossFinal(w+33) = ""
                            IF PossFinal(w+42) <>"$" THEN PossFinal(w+42) = ""
                            IF PossFinal(w+51) <>"$" THEN PossFinal(w+51) = ""
                        NEXT w
                    END IF
                    IF Block(z) = 7 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w+54) <>"$" THEN PossFinal(w+54) = ""
                            IF PossFinal(w+63) <>"$" THEN PossFinal(w+63) = ""
                            IF PossFinal(w+72) <>"$" THEN PossFinal(w+72) = ""
                        NEXT w
                    END IF
                    IF Block(z) = 8 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w+57) <>"$" THEN PossFinal(w+57) = ""
                            IF PossFinal(w+66) <>"$" THEN PossFinal(w+66) = ""
                            IF PossFinal(w+75) <>"$" THEN PossFinal(w+75) = ""
                        NEXT w
                    END IF
                    IF Block(z) = 9 THEN
                        FOR w = 1 TO 3
                            IF PossFinal(w+60) <>"$" THEN PossFinal(w+60) = ""
                            IF PossFinal(w+69) <>"$" THEN PossFinal(w+69) = ""
                            IF PossFinal(w+78) <>"$" THEN PossFinal(w+78) = ""
                        NEXT w
                    END IF
                NEXT z
             FOR z = 1 TO 9  '------------------------------------------- Set Rows to ""
                IF Row(z) = 1 THEN
                    FOR w = 1 TO 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Row(z) = 2 THEN
                    FOR w = 10 TO 18
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Row(z) = 3 THEN
                    FOR w = 19 TO 27
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Row(z) = 4 THEN
                    FOR w = 28 TO 36
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Row(z) = 5 THEN
                    FOR w = 37 TO 45
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Row(z) = 6 THEN
                    FOR w = 46 TO 54
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Row(z) = 7 THEN
                    FOR w = 55 TO 63
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Row(z) = 8 THEN
                    FOR w = 64 TO 72
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Row(z) = 9 THEN
                    FOR w = 73 TO 81
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
             NEXT z
             FOR z = 1 TO 9  '------------------------------------------- Set Columns to ""
                IF Col(z) = 1 THEN
                    FOR w = 1 TO 73 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Col(z) = 2 THEN
                    FOR w = 2 TO 74 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Col(z) = 3 THEN
                    FOR w = 3 TO 75 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Col(z) = 4 THEN
                    FOR w = 4 TO 76 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Col(z) = 5 THEN
                    FOR w = 5 TO 77 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Col(z) = 6 THEN
                    FOR w = 6 TO 78 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Col(z) = 7 THEN
                    FOR w = 7 TO 79 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Col(z) = 8 THEN
                    FOR w = 8 TO 80 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
                IF Col(z) = 9 THEN
                    FOR w = 9 TO 81 STEP 9
                        IF PossFinal(w) <>"$" THEN PossFinal(w) = ""
                    NEXT w
                END IF
            NEXT z
            '------------------------------------------------------- Get rid of "$" in Grid
            FOR z = 1 TO 81
                IF PossFinal(z) = "$" THEN PossFinal(z) = ""
            NEXT z   '---------------------------------------------------- Finished with Grid
        END SUB
        
        SUB Print_Top_Boxes   '------------------------------------------------------- Print_Top_Boxes
            LOCAL bxTop1,bxBot1 AS STRING
            r = 6 : c = 15
            bxTop1 = CHR$(218)+REPEAT$(5,CHR$(196))+CHR$(191)
            bxBot1 = CHR$(192)+REPEAT$(5,CHR$(196))+CHR$(217)
            LOCATE 1,60 : PRINT bxTop1   '------------------------------ Print Load,Erase,Save Buttons
            FOR z = 1 TO 3
               LOCATE 1+z,60 : PRINT CHR$(179); : LOCATE 1+z,66 : PRINT CHR$(179)
            NEXT z
            LOCATE 5,60 : PRINT bxBot1 : LOCATE 3,61 : PRINT "Erase";
                LOCATE 1,16 : PRINT bxTop1
            FOR z = 1 TO 3
               LOCATE 1+z,16 : PRINT CHR$(179); : LOCATE 1+z,22 : PRINT CHR$(179)
            NEXT z
            LOCATE 5,16 : PRINT bxBot1 : LOCATE 2,17 : PRINT "Load"; : LOCATE 4,17 : PRINT "File";
                LOCATE 1,104 : PRINT bxTop1
            FOR z = 1 TO 3
               LOCATE 1+z,104 : PRINT CHR$(179); : LOCATE 1+z,110 : PRINT CHR$(179)
            NEXT z
            LOCATE 5,104 : PRINT bxBot1 : LOCATE 2,105 : PRINT "Save"; : LOCATE 4,105 : PRINT "File";
            FOR w = 1 TO 99 STEP 11    '---------------------------------------- Print boxes 1 thru 9
                LOCATE r,c+w
                PRINT bxTop1
                FOR z = 1 TO 3
                    LOCATE r+z,c+w : PRINT CHR$(179); : LOCATE r+z,c+6+w : PRINT CHR$(179)
                NEXT z
                LOCATE r+4,c+w
                PRINT bxBot1
            NEXT w
            z = 0
            FOR w = 18 TO 106 STEP 11
                INCR z
                LOCATE 8,w : PRINT STR$(z);
            NEXT w
            LOCATE 11,30:PRINT "Click on a number then click on the Sudoku grid to place that number"
        END SUB
        SUB Print_Bot_Boxes '------------------------------------------------------- Print_Bot_Boxes
            LOCAL bxTop1,bxBot1,bxTop2,bxBot2 AS STRING
            r = 50 : c = 15
            bxTop1 = CHR$(218)+REPEAT$(5,CHR$(196))+CHR$(191)
            bxBot1 = CHR$(192)+REPEAT$(5,CHR$(196))+CHR$(217)
            FOR w = 1 TO 99 STEP 11
                LOCATE r,c+w
                PRINT bxTop1
                FOR z = 1 TO 3
                    LOCATE r+z,c+w : PRINT CHR$(179); : LOCATE r+z,c+6+w : PRINT CHR$(179)
                NEXT z
                LOCATE r+4,c+w
                PRINT bxBot1
            NEXT w
            z = 0
            FOR w = 18 TO 106 STEP 11
                INCR z
                LOCATE 52,w : PRINT STR$(z);
            NEXT w
            LOCATE 49,37 : PRINT "Click on a number to print that numbers possibilities"
            LOCATE 57,48 : PRINT "Esc to Quit...'P' to print Grid."
        END SUB
        
        SUB Print_main_box '--------------------------------------------------------- Print_main_box
            LOCAL fcolor,bcolor AS LONG
            r = 17 : c = 36
            LOCATE r,c
            PRINT CHR$(218)+REPEAT$(53,CHR$(196))+CHR$(191)             'print top
            FOR z = 1 TO 27                                             'print sides
                LOCATE r+z,c : PRINT CHR$(179); : LOCATE r+z,c+54 : PRINT CHR$(179)
            NEXT z
            LOCATE r+27,c
            PRINT CHR$(192)+REPEAT$(53,CHR$(196))+CHR$(217) '----------------------------print bottom
            FOR z = 1 TO 26
                LOCATE 17+z,54 : PRINT CHR$(179); : LOCATE 17+z,72 : PRINT CHR$(179)
            NEXT z
            LOCATE 17,54 : PRINT CHR$(194); : LOCATE 17,72 : PRINT CHR$(194)
            LOCATE 44,54 : PRINT CHR$(193); : LOCATE 44,72 : PRINT CHR$(193)
            '----------------------------------------------------------------------------------------
            FOR z = 1 TO 53
                LOCATE 26,36+z : PRINT CHR$(196);
                LOCATE 35,36+z : PRINT CHR$(196)
            NEXT z
            LOCATE 26,36 : PRINT CHR$(195); : LOCATE 26,90 : PRINT CHR$(180)
            LOCATE 35,36 : PRINT CHR$(195); : LOCATE 35,54 : PRINT CHR$(197);
            LOCATE 35,72 : PRINT CHR$(197); : LOCATE 35,90 : PRINT CHR$(180)
            FOR z = 42 TO 84 STEP 6      '------------------------------------------ Print_Vert_Lines
                LOCATE 17, z : PRINT CHR$(194); : LOCATE 26, z : PRINT CHR$(193);
                LOCATE 26,54 : PRINT CHR$(197); : LOCATE 26,72 : PRINT CHR$(197)
                FOR r = 18 TO 25
                    LOCATE r, z
                    PRINT CHR$(179);
                NEXT r
            NEXT z
            FOR z = 42 TO 84 STEP 6
                LOCATE 26, z : PRINT CHR$(197)
            NEXT
            '--------------------------------------------------------------------------------------
            FOR z = 42 TO 84 STEP 6
                LOCATE 26, z : PRINT CHR$(197); : LOCATE 26, z : PRINT CHR$(197);
                LOCATE 26,54 : PRINT CHR$(197); : LOCATE 26,72 : PRINT CHR$(197)
                FOR r = 27 TO 34
                    LOCATE r, z
                    PRINT CHR$(179);
                NEXT r
            NEXT z
            '---------------------------------------------------------------------------------------
            FOR z = 42 TO 84 STEP 6
                LOCATE 35, z : PRINT CHR$(197); : LOCATE 26, z : PRINT CHR$(197);
                LOCATE 35,54 : PRINT CHR$(197); : LOCATE 26,72 : PRINT CHR$(197)
                FOR r = 36 TO 43
                    LOCATE r, z
                    PRINT CHR$(179);
                NEXT r
            NEXT z
            FOR z = 42 TO 84 STEP 6
                LOCATE 44,z : PRINT CHR$(193);
            NEXT z
            '-------------------------------------------------------------------- Print_Horiz_Lines
            FOR z = 20 TO 41 STEP 3
                LOCATE z,36 : PRINT CHR$(195); : LOCATE z, 90 : PRINT CHR$(180);
                FOR c = 37 TO 89
                    LOCATE z, c
                    PRINT CHR$(196);
                NEXT c
            NEXT z
            r = 0
            FOR z = 42 TO 84 STEP 6
                FOR r = 20 TO 42 STEP 3
                    LOCATE r, z : PRINT CHR$(197);
                NEXT r
            NEXT
            fcolor = 9      '9 = light blue foreground --------------------------- Color_Grid_Lines
            bcolor = 15     '15 = background bright white.  7 = white
            FOR r = 17 TO 44   'paint columns
                LOCATE r,42 : COLOR fcolor,bcolor,1
                LOCATE r,48 : COLOR fcolor,bcolor,1
                LOCATE r,60 : COLOR fcolor,bcolor,1
                LOCATE r,66 : COLOR fcolor,bcolor,1
                LOCATE r,78 : COLOR fcolor,bcolor,1
                LOCATE r,84 : COLOR fcolor,bcolor,1
            NEXT r
            FOR c = 37 TO 89    'paint rows
                LOCATE 20,c : COLOR fcolor,bcolor,1
                LOCATE 23,c : COLOR fcolor,bcolor,1
                LOCATE 29,c : COLOR fcolor,bcolor,1
                LOCATE 32,c : COLOR fcolor,bcolor,1
                LOCATE 38,c : COLOR fcolor,bcolor,1
                LOCATE 41,c : COLOR fcolor,bcolor,1
            NEXT r
            COLOR 0,15  '------------------------ Clean up Joints
            LOCATE 20,54 : PRINT CHR$(197);
            LOCATE 20,72 : PRINT CHR$(197);
            LOCATE 23,54 : PRINT CHR$(197);
            LOCATE 23,72 : PRINT CHR$(197);
            LOCATE 29,54 : PRINT CHR$(197);
            LOCATE 29,72 : PRINT CHR$(197);
            LOCATE 32,54 : PRINT CHR$(197);
            LOCATE 32,72 : PRINT CHR$(197);
            LOCATE 38,54 : PRINT CHR$(197);
            LOCATE 38,72 : PRINT CHR$(197);
            LOCATE 41,54 : PRINT CHR$(197);
            LOCATE 41,72 : PRINT CHR$(197);
        END SUB
        
        SUB Load_Sudoku   '------------------------------------ Get from file & Print numbers to Grid
            LOCAL Dummy AS STRING
            Sound_Beep_Beep_Beep
            OPEN "Sudoku.dat" FOR INPUT AS #1
            w = 0 : r = 18
            FOR y = 1 TO 9
                z = 39
                INPUT #1,Dummy
                FOR x = 1 TO 9
                    INCR w
                    BoxNum(w) = MID$(Dummy,x,1)
                    IF BoxNum(w) = "-" THEN BoxNum(w) = ""
                    LOCATE r,z : PRINT BoxNum(w);
                    z = z + 6
                NEXT x
                r = r + 3
            NEXT y
            CLOSE #1
        END SUB
        
        SUB Save_Sudoku '------------------------------------------------ Save Grid numbers to file
            Sound_Beep_Beep_Beep '--------------------------------------- Sudoku.dat
            OPEN "Sudoku.dat" FOR OUTPUT AS #1                                        'File Format:
            FOR x = 1 TO 81 STEP 9                                                    '-2-7-----
                FOR z = 0 TO 8                                                        '9-5---1-4
                    IF BoxNum(x+z) = "" THEN BoxNum(x+z) = "-"                        '64-51--7-
                    PRINT #1, TRIM$(BoxNum(x+z));                                     '-8--9--2-
                NEXT z                                                                '45--7---3
                PRINT #1,                                                             '-3--6--1-
            NEXT x                                                                    '-6---1-97
            CLOSE #1                                                                  '5179--3-8
            FOR z = 1 TO 81                                                           '-9---7--1
                IF BoxNum(z) = "-" THEN BoxNum(z) = ""
            NEXT z
        END SUB
        
        SUB Sound_Beep_Beep_Beep  '------------------------------------------------- Sound 3 Beeps
            MOUSE OFF : MOUSE ON
            BEEP : SLEEP 150 : BEEP : SLEEP 150 : BEEP
        END SUB
        Last edited by Lynn Wakefield; 10 Feb 2008, 09:42 PM. Reason: Show the code

        Comment


        • #5
          Do you have several Threads and don't kill them wenn the program quits ?

          Sometimes the OS needs a little bit to give the EXE free.
          Regards,
          Hubert

          ------------------------------------
          http://familie-brandel.de/index_e.html

          Comment


          • #6
            Virus scanner/other security tools may also prevent the EXE from unloading.

            Comment


            • #7
              How do you get rid of ERROR 496?

              I remmed ' out all the lines in the entire file except these and I still get error 496

              Code:
              '#COMPILE EXE    '-------------------------------------- SudokuConsole.bas
              '#DIM ALL
              'GLOBAL c,r,x,y,w,z,Flag AS LONG
              'GLOBAL BoxNum(),i AS STRING
              'GLOBAL PossFinal() AS STRING
              'GLOBAL Block(),Col(),Row() AS LONG
              'DECLARE SUB MainProgram
              'DECLARE SUB Printmainbox
              'DECLARE SUB PrintTopBoxes
              'DECLARE SUB PrintBotBoxes
              'DECLARE SUB PutBoxNumber
              'DECLARE SUB PrintSudokuBox
              'DECLARE SUB PrintSudokuBoxes    '-----------9 Boxes
              'DECLARE SUB LoadSudoku
              'DECLARE SUB SaveSudoku
              'DECLARE SUB SoundBeepBeepBeep
              'DECLARE SUB CheckPossibilities
              '
              FUNCTION PBMAIN
              '    DIM BoxNum(1 TO 81) AS GLOBAL STRING
              '    DIM PossFinal(1 TO 81) AS GLOBAL STRING
              '
              '    CONSOLE SET LOC 1,1
              '    CONSOLE SET SCREEN 58,126
              '    CONSOLE SET FOCUS
              '    'COLOR 0,7  'Off white
              '    COLOR 0,15  'white
              '    CLS
                  'PrintTopBoxes
                  'PrintBotBoxes
                  'PrintMainbox
                  'MainProgram
                  'PrintSudokuBoxes
              '
              END FUNCTION
              Any ideas?

              Comment


              • #8
                Have you tried rebooting? And does rebooting allow you to compile without error? If these do not help, what about booting into safe mode, does that work? Have you tried compiling to a different path? Are you sure you have write permissions to this directory?
                Sincerely,

                Steve Rossell
                PowerBASIC Staff

                Comment


                • #9
                  How do you get rid of ERROR 496? Reply to Thread

                  Steve thanks for helping me. I have rebooted, booted to safe mode, compilled to another path, (no help). I am going to rename the file and start removing subs from the file and see what happens. I'll let you know, Thanks Lynn

                  Comment


                  • #10
                    How do you get rid of ERROR 496? Reply to Thread

                    Steve --- This is crazy, I renamed 'SudokuConsole.bas to Sud.bas for testing purposes (I was going to start removing subs, etc to see if that solved the proplem, guess what! Sud.bas runs fine. I tried renaming Sud.bas to Sudoku.bas - same problem! I tried "copy of SudokuConsole.bas" -- wont work. Renamed it back to Sud.bas -- works fine. Any ideas? I tried renaming the file to Test.bas -- error #496! Renamed it back to Sud.bas and it runs fine!
                    Lynn

                    Comment


                    • #11
                      Could you tell us something about the program / windows version you use ?

                      I would do a system check with anti virus software and a filesystem check.
                      Last edited by Hubert Brandel; 13 Feb 2008, 02:41 AM.
                      Regards,
                      Hubert

                      ------------------------------------
                      http://familie-brandel.de/index_e.html

                      Comment


                      • #12
                        What about AV software? Have you any "protective" programs running? If so, try disabling them and see if you experience the same problems.

                        Comment


                        • #13
                          Error 496

                          Lynn,

                          Try a search with test.* and SodokuConsole.*
                          I am willing to bet that you will find a bunch of them and
                          what you have is a PATH problem
                          Old QB45 Programmer

                          Comment


                          • #14
                            How do you get rid of ERROR 496?

                            Hubert, I am running windows XP.
                            I disabled Avast (virus program) - no help.

                            Guy, I searched and only found duplicates in the windows\prefetch directory.

                            I also have another computer in my garage running windows XP. Tried the program SudokuConsole.bas on it with the same results (error #496) after compiling it the 2nd time.

                            Comment


                            • #15
                              What is the entire path to SudokuConsole.bas?
                              And entire path to PBCC.exe?
                              Dale

                              Comment


                              • #16
                                Lynn,
                                What version of PBCC?

                                James

                                Comment


                                • #17
                                  You mentioned earlier that you remarked out every line and left only a blank PBMAIN function and still received error 496. But then you said that you need to remove some subs? Does this problem occur if you have only an empty PBMAIN function? What if you create a new program located in a different directory with a different name, does the problem still occur?
                                  Sincerely,

                                  Steve Rossell
                                  PowerBASIC Staff

                                  Comment


                                  • #18
                                    How do you get rid of ERROR 496?

                                    jcfuller: I am using PBCC4.04

                                    Steve If I creat or run other programs - - everything is OK.I had the Original SudokuConsole.bas down to an empty PBMAIN function and it still showed the #496 error, thats when I copied SudokuConsole.bas to Sud.bas then it worked ok. But I made some shanges in Sud.bas and now it won't work also. Maybe I should put my source code into the default PPCC4.04 Directory? Can you tell me what is the default directory?

                                    Comment


                                    • #19
                                      Wasn't there something in older versions (i dont know about the newer ones) where the exe name was limited to 8 characters ? That may not be a problem but thought id mention it.
                                      Client Writeup for the CPA

                                      buffs.proboards2.com

                                      Links Page

                                      Comment


                                      • #20
                                        Hi Lynn,
                                        I compiled your code and ran the program several times without any errors.
                                        I initially thought that the problem might lie in the program not shutting down properly and thus locking the executable.
                                        If this was the case then the compiler would not be able to write the new exe file to disk and thus generate an error.
                                        So I am confident that the problem may not be in your code.
                                        May I suggest that you install something like process lasso (free download from Bitsum Technologies) in order to see what is actually running on your computer. Maybe there is another process intervening.
                                        Also another utility called "unlocker" will show you if another program has somehow grabbed your executable, maybe anti malware or anti virus software or even some windows process.
                                        Is there more information?
                                        For example does this problem occur after you have printed something?
                                        Or are you exiting via the close window button instead of pressing 'esc'?
                                        At least if you use process lasso it will tell you if your program is still in memory when you attempt to recompile it.
                                        Another thing to try is to wait for ten or twenty seconds before recompiling, maybe for some reason your program is taking a long time to shut down.
                                        I mention this because I have written applications that didn't close properly until a thread had closed. This may be unlikely because the programs that I wrote were testing the com ports in a thread and until that process had finished the application couldn't properly unload (sloppy programming on my part), also there are no threads in your code.
                                        I hope that this helps you in some way.
                                        I know how frustrating it can be when a program can't be tamed properly
                                        Best Regards
                                        Gary Barnes
                                        The Control Key

                                        If you are not part of the solution
                                        then you are either a gas, solid, plasma or some other form of matter.

                                        Comment

                                        Working...
                                        X