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. swimming up stream

swimming up stream

Scheduled Pinned Locked Moved The Lounge
c++
13 Posts 5 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.
  • B BernardIE5317

    the C++ file stream behavior wrt openmode is not intuitive at least not to me . so my code was not behaving properly . as a result i tested its behavior with every combination of openmode values . ChatGBT was nice enough to write the combination generating code for me . so i now have a compendium of results to rely on and can now find the correct openmode values required for any situation .

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #2

    Write a Tip?

    B 1 Reply Last reply
    0
    • P PIEBALDconsult

      Write a Tip?

      B Offline
      B Offline
      BernardIE5317
      wrote on last edited by
      #3

      thank you for the suggestion . however my previous tips have always been removed as inconsequential . the code is simple enough . no doubt you can write it in no time at all . if you do not wish to bother with it i can provide same via DropBox as i do not have a Git account and have yet to learn how to utilize it .

      1 Reply Last reply
      0
      • B BernardIE5317

        the C++ file stream behavior wrt openmode is not intuitive at least not to me . so my code was not behaving properly . as a result i tested its behavior with every combination of openmode values . ChatGBT was nice enough to write the combination generating code for me . so i now have a compendium of results to rely on and can now find the correct openmode values required for any situation .

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        What exactly is not intuitive about those modes?

        R B 2 Replies Last reply
        0
        • L Lost User

          What exactly is not intuitive about those modes?

          R Offline
          R Offline
          RickZeeland
          wrote on last edited by
          #5

          As I'm not a regular C++ programmer I once had a similar problem, it was not clear to me the stream was written in text instead of binary format. Took me a very long time to find out what the problem was ...

          L 1 Reply Last reply
          0
          • R RickZeeland

            As I'm not a regular C++ programmer I once had a similar problem, it was not clear to me the stream was written in text instead of binary format. Took me a very long time to find out what the problem was ...

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            I guess my background from assembler and other base languages helped me with it.

            1 Reply Last reply
            0
            • L Lost User

              What exactly is not intuitive about those modes?

              B Offline
              B Offline
              BernardIE5317
              wrote on last edited by
              #7

              opening an existing file w/ ios_base::out causes its contents to disappear . to write to a existing file seekp'ed position requires ios_base::in | ios_base::out . to write to a non-existing file seekp'ed position requires ios_base::out .

              L 1 Reply Last reply
              0
              • B BernardIE5317

                opening an existing file w/ ios_base::out causes its contents to disappear . to write to a existing file seekp'ed position requires ios_base::in | ios_base::out . to write to a non-existing file seekp'ed position requires ios_base::out .

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                Yes, but that follows the basic IO model from C (OPEN, READ, fopen, fread etc.), and the Windows API (CreateFile, ReadFile ...). All use the same basic concepts, and the difference between writing binary data and text has always been there.

                honey the codewitchH B 2 Replies Last reply
                0
                • L Lost User

                  Yes, but that follows the basic IO model from C (OPEN, READ, fopen, fread etc.), and the Windows API (CreateFile, ReadFile ...). All use the same basic concepts, and the difference between writing binary data and text has always been there.

                  honey the codewitchH Online
                  honey the codewitchH Online
                  honey the codewitch
                  wrote on last edited by
                  #9

                  I hate that they cook text. I hate it so much. I once spent an entire day debugging my TTF engine because the IoT code I was using was opening my font file in text mode. The thing is, 90% of it worked.

                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                  L 1 Reply Last reply
                  0
                  • honey the codewitchH honey the codewitch

                    I hate that they cook text. I hate it so much. I once spent an entire day debugging my TTF engine because the IoT code I was using was opening my font file in text mode. The thing is, 90% of it worked.

                    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #10

                    honey the codewitch wrote:

                    opening my font file in text mode.

                    Well, I guess we have all been there at one time or another.

                    1 Reply Last reply
                    0
                    • L Lost User

                      Yes, but that follows the basic IO model from C (OPEN, READ, fopen, fread etc.), and the Windows API (CreateFile, ReadFile ...). All use the same basic concepts, and the difference between writing binary data and text has always been there.

                      B Offline
                      B Offline
                      BernardIE5317
                      wrote on last edited by
                      #11

                      CreateFile offers many options . all intuitive . how can deleting the contents of a file for output be intuitive . how can requiring read privileges in order to write be intuitive . never mind it is part of this or that IO model .

                      L 1 Reply Last reply
                      0
                      • B BernardIE5317

                        CreateFile offers many options . all intuitive . how can deleting the contents of a file for output be intuitive . how can requiring read privileges in order to write be intuitive . never mind it is part of this or that IO model .

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #12

                        That's why you should always study the documentation.

                        B 1 Reply Last reply
                        0
                        • L Lost User

                          That's why you should always study the documentation.

                          B Offline
                          B Offline
                          BernardIE5317
                          wrote on last edited by
                          #13

                          the documentation for openmode::out : "out open for writing" doesn't Howard Wolowitz do something w/ documuntation .

                          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