Announcement

Collapse
No announcement yet.

Updating an old file

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

  • Updating an old file

    Forum people...
    I have a bowling game I first wrote using Cell's Basic in 1988. I re-wrote it in 2012 into Power Basic 4 language. I haven't touched the code yet and it won't let me compile the old code. I also ran it in the Power Basic 6.4 version with the same result. The last compiled versions I have, on disc and flash drives, work fine. It is giving me a read/write error and I can't find what it wants. The Task Manager doesn't show two versions running at once. I tried everything on the help menu for the 496 error to no avail. Any help would be appreciated.
    Thanx...
    Izzy

    Code might or might not help...

    Code:
    OPEN "BOWL.SCR" FOR INPUT AS #1   '  Bring in the names and scores of the last scoreboard saved to the disk
    FOR Z=1 TO 10
    INPUT #1, NAMES$(Z), SCORE(Z)
    NEXT
    CLOSE #1
    
    ' HERE IS WHERE YOU ADD THE NAMES AND SCORES, IN PROPER PLACE, BEFORE WRITING TO FILE AND PRINTING TO SCREEN
    IF PT(10)>SCORE(1)THEN SWAP PT(10),SCORE(1):SWAP N1$,NAMES$(1)  '  SWAP CURRENT SCORE, IF NECESSARY
    FOR Z=1 TO 10
    IF PT(10)>SCORE(Z)THEN SWAP PT(10),SCORE(Z):SWAP N1$,NAMES$(Z)  '  RE-ALIGN THE SCOREBOARD IF NECESSARY
    NEXT
    IF HM=1 THEN GOTO SKIPSECONDNAME
    FOR Z=1 TO 10
    IF PT2(10)>SCORE(Z)THEN SWAP PT2(10),SCORE(Z):SWAP N2$,NAMES$(Z)
    NEXT
    
    
    
                    SKIPSECONDNAME:
    '   WE WILL NOW WRITE THE NEW LIST TO THE DISK
    OPEN "BOWL.SCR" FOR OUTPUT AS #1
    FOR Z=1 TO 10
    WRITE #1, NAMES$(Z), SCORE(Z)
    NEXT
    CLOSE #1
    GOSUB SHOWSCORES  '  GO TO SHOWSCORES TO SHOW THEM ON THE SCREEN

  • #2
    If I recall, 496 == compiler can't write the new executable. If so, the my first stop would be disabling AV.. Second stop would be to use #COMPILE EXE to specify where the new executable goes; Win 7/10 are finicky about writing to certain folders.
    Real programmers use a magnetized needle and a steady hand

    Comment


    • #3
      .. , or the target file is write-protected (read-only)...
      Rgds, Dave

      Comment


      • #4
        You might experience some kind of anti-malware protection interfering with your compile, because ...
        Code:
        OPEN "BOWL.SCR" FOR INPUT AS #1
        ... *.scr is the file extension of Window's screen savers, which are (oversimplified) ordinary Windows executables (*.exe). Camouflaging *.exe as *.scr (which Windows will happily execute) in the hope to bypass filters which catch *.exe files only is a standard recipe in malware writer's cook book.

        And as Bud already mentioned,you want to also make sure that the Windows user compiling the code, has the necessary access rights to the location in which the EXE is supposed to be created. MS thankfully has restricted the locations in which a non-administrative user account has write access.

        Comment


        • #5
          Thanx, Knuth...
          I followed Dave and Bud's suggestions and now yours...
          I changed the extension from SCR to SCZ on the input and write lines and checked to see if the program was still running... [ctrl-alt-del]
          It wasn't running and the BOWL.SCZ file properties section did not have the read only checked...
          I re-booted the machine to clear the memory and it still won't compile... It does SAVE using the disc icon...
          The program also has the #compile exe command up top and in this mode saves to the folder program is now in... (local folder)
          I am stumped... Might just have to forget the update which was to have the pins now being struck, with the ball, a little after the sound of the pins being struck...
          For a program that was written in the early 80's, it is really a neat program... The whizzes today would run circles around it with the PYTHON and other game writing programs... I would download the code for all to see or play but I don't know how... Also... The play files would have to also be downloaded and that is another problem for moi...
          Izzy

          Comment


          • #6
            Data and program (.exe) in same folder.

            No error checking. (at OPEN, 2 places; and READ and WRITE.)
            Dale

            Comment


            • #7
              Originally posted by Izzy Zeitz View Post
              Thanx, Knuth...
              I followed Dave and Bud's suggestions and now yours...
              I changed the extension from SCR to SCZ on the input and write lines and checked to see if the program was still running... [ctrl-alt-del]
              It wasn't running and the BOWL.SCZ file properties section did not have the read only checked...
              I re-booted the machine to clear the memory and it still won't compile... It does SAVE using the disc icon...
              The program also has the #compile exe command up top and in this mode saves to the folder program is now in... (local folder)
              I am stumped... Might just have to forget the update which was to have the pins now being struck, with the ball, a little after the sound of the pins being struck...
              For a program that was written in the early 80's, it is really a neat program... The whizzes today would run circles around it with the PYTHON and other game writing programs... I would download the code for all to see or play but I don't know how... Also... The play files would have to also be downloaded and that is another problem for moi...
              Izzy
              Antivirus program interfering? Try excluding the directory from your AV scanning, or termporarily disable it.

              Comment


              • #8
                Hi, people of the programming world...
                I took a shot and uninstalled any and all virus programs... Ran the compiler and up popped the 496 warning again... I guess the program doesn't like me... Let it stand in line with the myriad of others... Time to forget the update of my program... It was a minor change and did not affect the brilliance of the programmer... What's that you ask... No, I don't have an ego problem... You are just misreading my programming abilities with those of Quasimodo...
                I still want to upload the program to the Power Basic files for ancient users of that data base... Where is it hidden... I remember downloading some files from it a while back, when the last seven brain cells I had were still working, but these stupid birthdays keep diminishing my concentration and perception...
                Thanx...
                Izzy

                Comment


                • #9
                  Izzy Zeitz , can you tell us the path where the executable is supposed to be created in? That looks very much like you're trying to create the application in an off-limit location.

                  Comment


                  • #10
                    Hi, Knuth...
                    The basic file is in C:/PBCC60/workfiles and is called Bowling.bas
                    There is an executable file there that was compiled after the last update in 2016...
                    I renamed the file Bowling-x.exe so it would not be overwritten with a file that wasn't doing what was intended and could not be replaced, as I am now in that situation.
                    By renaming it, I still have the original working file... Any Tyros reading this, you have just had a free lesson on saving your as*... Sometimes just backing up a file isn't enough protection...
                    Thanx Knuth for following this up... I just thought it wasn't worth any more effort... You are a much more dedicated person than I am now...
                    Izzy

                    Comment


                    • #11
                      Izzy,
                      Can you compile any of the sample source code files inside this same folder. If so try this. Save the source file you can compile under another name (save as). Then open it and delete its contents and paste all your bowling source code and save. Then try compiling.

                      Comment


                      • #12
                        Nick and Knuth...
                        I did better than that... search for Bowling game, in the search box, and you will find entire program in the Program Section.
                        I hope you can find it and run it...
                        Let me know please if you can...
                        Izzy...
                        Thanx for your interest in helping me solve this problem...
                        If it compiles for you, then the problem must be in my machine...

                        Comment


                        • #13
                          Originally posted by Izzy Zeitz View Post
                          Nick and Knuth...
                          I did better than that... search for Bowling game, in the search box, and you will find entire program in the Program Section.
                          Or just go to here:
                          https://forum.powerbasic.com/forum/u...6-bowling-game

                          Comment


                          • #14
                            Stuart...
                            Thanx for the shortcut... It only took me 35 minutes to find the place to upload the file...
                            Just wondering if you downloaded it and ran it, or if you got a compiling error as I did...
                            Izzy

                            Comment


                            • #15
                              Originally posted by Izzy Zeitz View Post
                              Stuart...
                              Thanx for the shortcut... It only took me 35 minutes to find the place to upload the file...
                              Just wondering if you downloaded it and ran it, or if you got a compiling error as I did...
                              Izzy
                              Hi Issy, I don't have CC6, just an old ClassicCC (Ver 4) so can't compile it with CC, but I did load it into PBWIN 10, commented out the #CONSOLE OFF and #RESOURCE lines and it compiled and ran fine.

                              Comment


                              • #16
                                Hi Izzy,
                                The file downloaded here ok. Compiled in Win10 with PBCC604.
                                Needed to comment out background music as file not found but then OK.
                                Compiled executable ran just fine - for this crap bowler
                                Rgds, Dave

                                Comment


                                • #17
                                  Originally posted by Izzy Zeitz View Post
                                  Hi, Knuth...
                                  The basic file is in C:/PBCC60/workfiles and is called Bowling.bas
                                  There is an executable file there that was compiled after the last update in 2016...
                                  I renamed the file Bowling-x.exe so it would not be overwritten with a file that wasn't doing what was intended and could not be replaced, as I am now in that situation.
                                  By renaming it, I still have the original working file... Any Tyros reading this, you have just had a free lesson on saving your as*... Sometimes just backing up a file isn't enough protection...
                                  Thanx Knuth for following this up... I just thought it wasn't worth any more effort... You are a much more dedicated person than I am now...
                                  Izzy
                                  So have you checked the (file system) attributes and (user) permission on that folder / executable. A simple ReadOnly attribute of the EXE could prevent PB from successfully creating a new EXE. Also: if the user doesn't have modify permissions for that folder, renaming/deleting doesn't wok either.

                                  Comment


                                  • #18
                                    First let me say thanx to all of you for hanging in there... Time to take the program out behind the barn and bury it...
                                    I don't have win10... but I do have Classic versions 4 and 8... Nothing good happening there...
                                    A previous bowling version is working just fine, so whatever is happening must be in some place I am not looking...
                                    I especially like to play the game using the two bowlers option... I always seem to win with one of the choices...
                                    Thanx again for your help and I hope no one is in the snow belt in the northeast...
                                    What a rotten day down here in Florida... Didn't even get to 70... Barely made 68... Needed a light jacket...
                                    Was at the Mets game today... The Nationals won 8 to 5... The stadium is 7 miles from my house... Hot-dogs sucked...
                                    Izzy

                                    Comment


                                    • #19
                                      To all of you fantastic programmers and program sleuths:
                                      First of all, I apologize for putting you through a lot of time and trouble to help me solve the compiling issue...
                                      I actually found the trouble, while sleeping, as a problem that is usually not possible. When you are in windows explorer and save a file that has the same name as a file that already exists, you are asked if you want to overwrite, or replace the existing file...Using that road as my direction, I changed the name of the basic file and it compiled with no problem... I don't know why this happened, or am I going to worry about it anymore... I am hereby hanging up my programming hat and putting on my TV watching hat... Thanx for all your help and best of luck to all...
                                      "Live Long And Prosper."
                                      Izzy

                                      Comment

                                      Working...
                                      X