Announcement

Collapse
No announcement yet.

string space corruption in Windows 10

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

  • string space corruption in Windows 10

    Trying to develop a Windows 10 computer. Patched a many years successful PBCC v6.03 program created for my Windows 7 computers to conform to the different Windows 10 directory structure. When I run the program, I find that my string array entries are being corrupted with a nine character lead phrase which Windows 10 appears to have picked up from the local URL of the file from which the entries in the string array were read. When I patch to graphic print the contents of the array, they come out correctly. But when called up for display as part of the program operations, the nine character lead phrase has been added to each and every one of the graphic prints. Is this strictly a Windows 10 defect or is there something I can do in PBCC v6.03 to get it to work correctly.

  • #2
    I'd highly doubt it is a PB or Win10 issue. Sounds more like a coding issue but hard to tell without code.
    <b>George W. Bleck</b>
    <img src='http://www.blecktech.com/myemail.gif'>

    Comment


    • #3
      Code not show. A compilable example would help to diagnose the cause.

      Many people are using PBCC6 on win10. This is the first report of any such behaviour which suggest that the problem has another origin.

      Comment


      • #4
        The code under Windows 10 which creates the string array is as follows:

        SFN="c:\users\BobG\stocks\mynotes\groups\lfn.lst":IFN=FREEFILE
        OPEN SFN FOR INPUT AS IFN
        INPUT #IFN,KGRIM SGR(KGR):SGR(0)="none"
        FOR I=1 TO KGR
        INPUT #IFN,S:S=UCASE$(S):J=INSTR(S,"."):SGR(I)=LEFT$(S,J-1)
        NEXT I:CLOSE IFN

        Instead of the expected content from the file "lfn.lst", what appears
        on my screen when I use the array is instead shown in the first screenshot:
        Click image for larger version

Name:	onWin10.jpg
Views:	86
Size:	156.1 KB
ID:	783097
        The only difference in the seven year successful Windows 7 version is

        SFN="c:\stocks\mynotes\groups\lfn.lst"

        which reflects the majorly different directory structure under Windows 7.
        That is shown in the second screenshot with its *correct* and intended information.
        Click image for larger version

Name:	onwin7.jpg
Views:	70
Size:	143.7 KB
ID:	783098

        Comment


        • #5
          Noticing that the colon D as part of separator and "dim" have been transmogrified into an absurd smiley in my code presentation ;(##

          Comment


          • #6
            Simplest first - put a space before and after colons used as logical line separators. Prevents smileys here and (IMO) makes code easier to read in IDE.

            Second simplest - Indent code (can't tell if you do), and use code tags to maintain indentation here. Example using your code-
            Code:
            SFN="c:\users\BobG\stocks\mynotes\groups\lfn.lst" : IFN=FREEFILE
            OPEN SFN FOR INPUT AS IFN
            INPUT #IFN, KGRIM SGR(KGR) : SGR(0)="none"
            FOR I=1 TO KGR
              INPUT #IFN,S : S=UCASE$(S) : J=INSTR(S,".") : SGR(I)=LEFT$(S,J-1)
            NEXT I : CLOSE IFN
            Now related to problem - the 9 are coming from variable SFN. But a lot of string parsing, formatting and printing code is not shown.
            Maybe you mistyped one of SFN, IFN or SRG.
            Code as shown will not cause what is in first screen shot.

            ((late thought - copy code you want to show, click "#" button on tool bar, paste the code between the tags (which is where cursor is after "#"). I've found if you paste first then create the tags before and after the code that indentation is lost.))(((if you don't see the tool bar, click underlined "A" button.)))

            Cheers,
            Dale

            Comment


            • #7
              Late, late thought - "Programming" or "Console Compiler" section may have been a better place for this discussion. I think this section is more about the forum itself.

              Cheers again,
              Dale

              Comment


              • #8
                Bob,

                You are trimming SGR() elements by too few characters before Printing.

                LEN( c:\users\BobG\stocks\myno ) = LEN( c:\stocks\mynotes\groups\ )
                Rgds, Dave

                Comment


                • #9
                  Thanks for your comments Dale. Of course I am indenting the actual lines of code and the need for a space after the colon is unique to this forum (but I am inserting those spaces for this local presentation of the relevant code). I realized later this evening that there is a more relevant to the problem section of code: the one that actually prints out the (correct in Windows 7 but botched in Windows 10) details shown in my screenshots. The code is as follows:

                  '**** PROCEDURES FOR CHANGING GROUP MEMBERSHIPS OF STOCKS ****
                  1000 GOSUB 400 'displays the numbered list from SGR(KGR) correctly on both operating systems
                  1010 GRAPHIC PRINT: GRAPHIC PRINT "What Ticker Symbol to Change Memberships? ";
                  GRAPHIC INPUT SYM: SYM=UCASE$(SYM)
                  1030 GRAPHIC PRINT SYM;" now appears in groups "; 'this is where the problem starts
                  '#### FINDSTR is an intrinsic Win7 command roughly equivalent to the former
                  '#### "grep" utility. That code was however generating an "illegal function
                  '#### call" ERROR 5 which refused to be further identified with OBJRESULT
                  '#### the same FINDSTR exists and works in Windows 10
                  SHELL (MyApp$,1)
                  SHELL (ENVIRON$("COMSPEC") + " /C findstr "+SYM+" c:\users\BobG\stocks\mynotes\groups\*.txt >stuffy")
                  SFN="stuffy": IFN=FREEFILE: OPEN SFN FOR INPUT AS IFN
                  1060 IF EOF(IFN) THEN CLOSE IFN: GRAPHIC PRINT: KILL "stuffy": GOTO 1080
                  INPUT #IFN,SLI: SLI=RIGHT$(SLI,-25)
                  I=INSTR(SLI,":"): S=MID$(SLI,I+1): IF S<>SYM THEN 1060
                  I=INSTR(SLI,"."): SLI=LEFT$(SLI,I-1): SLI=UCASE$(SLI)
                  IF GRAPHIC (POS.X)>700 THEN GRAPHIC PRINT :GRAPHIC PRINT SPACE$(8);
                  GRAPHIC PRINT SLI;" ";: GOTO 1060
                  1080 GRAPHIC GET POS TO I,J: GRAPHIC PRINT;"From Which Group Number/0? ";
                  GRAPHIC INPUT IFG: IF J>432 THEN J=J-18
                  GRAPHIC SET POS (I+270+10*LEN(STR$(IFG)),J): GRAPHIC PRINT SGR(IFG)
                  GRAPHIC GET POS TO I,J: GRAPHIC PRINT;"To Which Group Number/0? ";
                  GRAPHIC INPUT ITG: IF J>432 THEN J=J-18
                  GRAPHIC SET POS (I+250+10*LEN(STR$(ITG)),J): GRAPHIC PRINT SGR(ITG)
                  GRAPHIC PRINT "Okay to Proceed with Membership Change for ";SYM;" (Y/N)? ";
                  GRAPHIC WAITKEY$ TO S: S=UCASE$(S): GRAPHIC PRINT S
                  IF S="N" THEN 1010

                  Comment


                  • #10
                    P.S. Dale: I had nothing to do with choosing which forum to post my original question. "The system" made that decision without consulting me.

                    Comment


                    • #11
                      As for your comment, Dave Biggs, the directory specification has nothing to do with SGR itself which is clearly being loaded properly based on the identical presentation of all of the SGR() elements in the top portion of each of my screen shots. It does, however, appear to have something to do with the FINDSTR coding presented in my latest detail code post (but I can't see what's wrong with that code "yet").

                      Comment


                      • #12

                        Bob...

                        You need to add code tags before and after your code when you post... like this...

                        <b>George W. Bleck</b>
                        <img src='http://www.blecktech.com/myemail.gif'>

                        Comment


                        • #13
                          PROBLEM SOLVED :-)## Actually it was Dave Biggs who pointed me in the direction of solving the problem. First step was to force myself to *look at* that temporary file "stuffy" which in fact had the entire local URL recited at the beginning of every line of *it*. Then I had to modify the line "INPUT #IFN,SLI: SLI=RIGHT$(SLI,-25)" to make it discard -36 characters, at which point my proggie started functioning identically under Windows 10 to the way that it works under Windows 7 with its shorter local URLs. Many thanks to all of those who participated in helping me think through *where* the problem originated. In fact it *was* a mere two digit *coding* problem having nothing to do with the functionality of Windows 10 nor PBCC v6.03.

                          Comment


                          • #14
                            Originally posted by Bob Grumbine View Post
                            PROBLEM SOLVED :-)## Actually it was Dave Biggs who pointed me in the direction of solving the problem. First step was to force myself to *look at* that temporary file "stuffy" which in fact had the entire local URL recited at the beginning of every line of *it*. Then I had to modify the line "INPUT #IFN,SLI: SLI=RIGHT$(SLI,-25)" to make it discard -36 characters, at which point my proggie started functioning identically under Windows 10 to the way that it works under Windows 7 with its shorter local URLs. Many thanks to all of those who participated in helping me think through *where* the problem originated. In fact it *was* a mere two digit *coding* problem having nothing to do with the functionality of Windows 10 nor PBCC v6.03.
                            Lesson for you - one I learned over 50 years ago

                            When you blame the operating system or the compiler, there is a 99.9% chance that you are wrong. It is almost certain that the fault is you and your code.

                            It is a hard lesson. It is one of the tough logic lessons that taught me what it is like to be a real programmer.

                            All the best.
                            [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                            Kerry Farmer

                            Comment


                            • #15
                              Unable to duplicate being "forced" to post in this section.

                              At home page click on section name, for example "Programming", click on the "New Topic" button (not the "New Posts" tab right above it) Make your comments/question, click "Post" button. The post will be in the intended section.

                              ----------------------------------------------------------------------
                              Re: Code in post#9
                              See Georges version of what I tried to explain before. You can type the tags yourself, or use the big "#" on the tool bar. Create the tags first, then type or paste the code between them. I've had a problem where putting code first. It uses "regular" HTML rules. (leading white space (spaces, tabs) on a line removed, multiple spaces together in a line are reduced to one, line length based on window width (CRLFs ignored). ((I suspect the auto-save feature))

                              When you create the code tags first, the forum software uses html pre and /pre and mono-spaced font (spaces, CRLFs not changed and vertical alignment of character positions is maintained).
                              Dale

                              Comment


                              • #16
                                George Bleck now that I've resolved my problem with a years successful proggie botching itself, I now understand your pointer on how to get my code to display as written with the system required HTML tagging. Thanks for the pointer.

                                Dale Yarker It has now been nearly seven years since I needed to go into the forums to solve a problem (when I was converting to Windows 7 with PBCC v6.03 instead of my beloved TurboBASIC). So I was a bit klunky about HOW TO POST. Made a record of your pointer on how to post.

                                Comment

                                Working...
                                X