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. Other Discussions
  3. Clever Code
  4. How about this one?

How about this one?

Scheduled Pinned Locked Moved Clever Code
question
9 Posts 8 Posters 4 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.
  • E Offline
    E Offline
    ed welch
    wrote on last edited by
    #1

    reading an x and y co-ordinate from a file: object.SetPosition(file.ReadFloat(), file.ReadFloat()); can you spot the mistake?

    P A CPalliniC R E 7 Replies Last reply
    0
    • E ed welch

      reading an x and y co-ordinate from a file: object.SetPosition(file.ReadFloat(), file.ReadFloat()); can you spot the mistake?

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

      Ummm... I'm guessin' they're probably ints?

      1 Reply Last reply
      0
      • E ed welch

        reading an x and y co-ordinate from a file: object.SetPosition(file.ReadFloat(), file.ReadFloat()); can you spot the mistake?

        A Offline
        A Offline
        Anthony Mushrow
        wrote on last edited by
        #3

        It reads the same float twice? :confused:

        My current favourite word is: Nipple!

        -SK Genius

        1 Reply Last reply
        0
        • E ed welch

          reading an x and y co-ordinate from a file: object.SetPosition(file.ReadFloat(), file.ReadFloat()); can you spot the mistake?

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          The order of reading operations is arbitrary, hence may happen that it set the position at (y,x) point.

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

          In testa che avete, signor di Ceprano?

          E 1 Reply Last reply
          0
          • E ed welch

            reading an x and y co-ordinate from a file: object.SetPosition(file.ReadFloat(), file.ReadFloat()); can you spot the mistake?

            R Offline
            R Offline
            Robert Surtees
            wrote on last edited by
            #5

            Both arguments modify file so the result is unspecified. Might end up reading y, x

            1 Reply Last reply
            0
            • E ed welch

              reading an x and y co-ordinate from a file: object.SetPosition(file.ReadFloat(), file.ReadFloat()); can you spot the mistake?

              E Offline
              E Offline
              Ed Poore
              wrote on last edited by
              #6

              object is a reserved word in C#?


              My Blog[^]

              1 Reply Last reply
              0
              • CPalliniC CPallini

                The order of reading operations is arbitrary, hence may happen that it set the position at (y,x) point.

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                E Offline
                E Offline
                ed welch
                wrote on last edited by
                #7

                Bingo! you guessed correctly I had fun yesterday with that one ;)

                1 Reply Last reply
                0
                • E ed welch

                  reading an x and y co-ordinate from a file: object.SetPosition(file.ReadFloat(), file.ReadFloat()); can you spot the mistake?

                  D Offline
                  D Offline
                  Derek Bartram
                  wrote on last edited by
                  #8

                  It is bad coding style. You arn't using XML.... sorry I forget everyone doesn't subscribe to the Microsoft XML band wagon

                  1 Reply Last reply
                  0
                  • E ed welch

                    reading an x and y co-ordinate from a file: object.SetPosition(file.ReadFloat(), file.ReadFloat()); can you spot the mistake?

                    G Offline
                    G Offline
                    Gary R Wheeler
                    wrote on last edited by
                    #9

                    Premature EOF would do Bad Things, I would imagine.

                    Software Zen: delete this;
                    Fold With Us![^]

                    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