Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Just Plain Weird

Just Plain Weird

Scheduled Pinned Locked Moved The Lounge
question
15 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • realJSOPR realJSOP

    Using VC6/SP4 on Win2K/SP1... I have an INI file (shipped with another program written by another company) that has sections that look like this:

    [ Section ]
    key1 = value
    key2 = value
    key3 = value

    (Yes, the spaces I put in the listing above actually do exist in the INI file.) The program I wrote that reads this INI file compiles and runs fine on Win2K, but on Win98 ist fails to find the sections (and maybe the keys but I don't know that yet). It fails to read the INI file (can't find section names), even if I use GetPrivateProfileSection and parse out the keys manually. Everything I tried on my Win2k machine worked flawlessly, but each method failed miserably on the win98 machine. Does VC6 create different code when compiled on win2k than it does when compiled on Win98? I know this sounds like I'm grasping at straws, but this is driving me absolutely nuts.

    W Offline
    W Offline
    Wayne Fuller
    wrote on last edited by
    #6

    I normally use spaces in between the keys but never the sections. Have you tried GetPrivateProfileSectionNames(...) to get the section names of the ini file? Maybe you have to use " Section ", instead of "Section". I dunno :confused: Wayne

    realJSOPR 1 Reply Last reply
    0
    • realJSOPR realJSOP

      Using VC6/SP4 on Win2K/SP1... I have an INI file (shipped with another program written by another company) that has sections that look like this:

      [ Section ]
      key1 = value
      key2 = value
      key3 = value

      (Yes, the spaces I put in the listing above actually do exist in the INI file.) The program I wrote that reads this INI file compiles and runs fine on Win2K, but on Win98 ist fails to find the sections (and maybe the keys but I don't know that yet). It fails to read the INI file (can't find section names), even if I use GetPrivateProfileSection and parse out the keys manually. Everything I tried on my Win2k machine worked flawlessly, but each method failed miserably on the win98 machine. Does VC6 create different code when compiled on win2k than it does when compiled on Win98? I know this sounds like I'm grasping at straws, but this is driving me absolutely nuts.

      T Offline
      T Offline
      Tim Deveaux
      wrote on last edited by
      #7

      Wonder if at some point that file became unicode?

      A 1 Reply Last reply
      0
      • T Tim Deveaux

        Wonder if at some point that file became unicode?

        A Offline
        A Offline
        Anders Molin
        wrote on last edited by
        #8

        You might have a point there, it it's unicode win9x don't like it, and NT just reads it... John: Try to open the file in notepad, in win2k, click save as, and see if it want to save it as unicode... - Anders Money talks, but all mine ever says is "Goodbye!"

        1 Reply Last reply
        0
        • realJSOPR realJSOP

          I'm not angry or annoyed at you or anyone else. What I'm annoyed about is that I have to write a class that reads the entire file and parses the whole daggone thing because the company that produced this INI file in the first place blew it big time by creating a non-standard INI file, and some versions of Windows can't handle it. What's worse is that the other program in question has 27 INI files, two of which are properly formatted, but the rest of which are formatted incorrectly. I "scrubbed" one of the files (removed the offending spaces) to see if the other program would still read it correctly, and it does, so that just deepens the level of annoyance even more because they could have written it correctly in the first place.

          M Offline
          M Offline
          Mike Breaton
          wrote on last edited by
          #9

          Why dont you just write a proggy to fix the invalid files?

          T realJSOPR 2 Replies Last reply
          0
          • M Mike Breaton

            Why dont you just write a proggy to fix the invalid files?

            T Offline
            T Offline
            Tom Archer
            wrote on last edited by
            #10

            A "proggy"? LOL! Chris, you and I are getting too old for this industry!

            A 1 Reply Last reply
            0
            • T Tom Archer

              A "proggy"? LOL! Chris, you and I are getting too old for this industry!

              A Offline
              A Offline
              Anders Molin
              wrote on last edited by
              #11

              That means that I'm also too old... I would prefer to say that some of the other are too young. I don't like to be "too old" just yet ;P - Anders - Anders Money talks, but all mine ever says is "Goodbye!"

              1 Reply Last reply
              0
              • M Mike Breaton

                Why dont you just write a proggy to fix the invalid files?

                realJSOPR Offline
                realJSOPR Offline
                realJSOP
                wrote on last edited by
                #12

                That's what I ended up doing...:suss:

                1 Reply Last reply
                0
                • W Wayne Fuller

                  I normally use spaces in between the keys but never the sections. Have you tried GetPrivateProfileSectionNames(...) to get the section names of the ini file? Maybe you have to use " Section ", instead of "Section". I dunno :confused: Wayne

                  realJSOPR Offline
                  realJSOPR Offline
                  realJSOP
                  wrote on last edited by
                  #13

                  It found the section names in when I used GetPrivateProfileSectionNames(), but it wouldn't find them when I used GetPrivateProfileSection() or GetPrivateProfileString(). Weird. I think MS has a bug in the API, but since these functions are "obsolete", we'll never see a fix.

                  W 1 Reply Last reply
                  0
                  • realJSOPR realJSOP

                    It found the section names in when I used GetPrivateProfileSectionNames(), but it wouldn't find them when I used GetPrivateProfileSection() or GetPrivateProfileString(). Weird. I think MS has a bug in the API, but since these functions are "obsolete", we'll never see a fix.

                    W Offline
                    W Offline
                    Wayne Fuller
                    wrote on last edited by
                    #14

                    Were there extra spaces in the section names? If there are that would explain the reason GetPrivateProfileSection() and GetPrivateProfileString() are not working. Wayne

                    realJSOPR 1 Reply Last reply
                    0
                    • W Wayne Fuller

                      Were there extra spaces in the section names? If there are that would explain the reason GetPrivateProfileSection() and GetPrivateProfileString() are not working. Wayne

                      realJSOPR Offline
                      realJSOPR Offline
                      realJSOP
                      wrote on last edited by
                      #15

                      Yeah, there were spaces in the section names, but the bug (in Win9x/ME) is this - I could retrieve the section names, but I couldn't get sections in therir entirety or key values in those sections. It's a bug in KERNEL32.DLL, and will never be fixed because a) it involves "obsolete" operating systems, and b) involves "obsolete" API functions.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups