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. General Programming
  3. C / C++ / MFC
  4. isspace!?

isspace!?

Scheduled Pinned Locked Moved C / C++ / MFC
question
12 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.
  • N NiceNaidu fo

    Where are you incrementing the loop ??? What is your requirement exactly ??

    Appu.. "If you judge people, you have no time to love them."

    T Offline
    T Offline
    tanarnelinistit
    wrote on last edited by
    #3

    My question was am I using isspace the right way? should i include or define smth to use isspace? The loop is incremented in the serial.Read(...) function.

    Steve EcholsS 1 Reply Last reply
    0
    • T tanarnelinistit

      My question was am I using isspace the right way? should i include or define smth to use isspace? The loop is incremented in the serial.Read(...) function.

      Steve EcholsS Offline
      Steve EcholsS Offline
      Steve Echols
      wrote on last edited by
      #4

      Well isspace returns true if it is a white space character, and false if it's a real character. Did you post a code fragment, or was it all the code?


      - S 50 cups of coffee and you know it's on!

      • S
        50 cups of coffee and you know it's on!
        Code, follow, or get out of the way.
      N 1 Reply Last reply
      0
      • Steve EcholsS Steve Echols

        Well isspace returns true if it is a white space character, and false if it's a real character. Did you post a code fragment, or was it all the code?


        - S 50 cups of coffee and you know it's on!

        N Offline
        N Offline
        NiceNaidu fo
        wrote on last edited by
        #5

        It is wrong.To find out the reason chk this. http://msdn2.microsoft.com/en-us/library/x9wa4512.aspx[^]

        Appu.. "If you judge people, you have no time to love them."

        Steve EcholsS T 2 Replies Last reply
        0
        • N NiceNaidu fo

          It is wrong.To find out the reason chk this. http://msdn2.microsoft.com/en-us/library/x9wa4512.aspx[^]

          Appu.. "If you judge people, you have no time to love them."

          Steve EcholsS Offline
          Steve EcholsS Offline
          Steve Echols
          wrote on last edited by
          #6

          Yeah, that just repeats what I said. How is it "wrong"?


          - S 50 cups of coffee and you know it's on!

          • S
            50 cups of coffee and you know it's on!
            Code, follow, or get out of the way.
          T 1 Reply Last reply
          0
          • T tanarnelinistit

            Hello i'm trying to use this do-while loop but it seems that it doesn't work the way I like it to: char szBuffer[18]; do { serial.Read(szBuffer,nBuflen,&dwBytesRead); szBuffer[dwBytesRead] = '\0'; } while (isspace(szBuffer[0])==0);

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #7

            What is it "isspace"?

            _**


            **_

            whitesky


            1 Reply Last reply
            0
            • Steve EcholsS Steve Echols

              Yeah, that just repeats what I said. How is it "wrong"?


              - S 50 cups of coffee and you know it's on!

              T Offline
              T Offline
              tanarnelinistit
              wrote on last edited by
              #8

              The loop should continue until I have non-space caractert e.g. szBuffer[0] != ' ' or szBuffer[0] != '\r', well, it doesn't...

              Steve EcholsS D 2 Replies Last reply
              0
              • N NiceNaidu fo

                It is wrong.To find out the reason chk this. http://msdn2.microsoft.com/en-us/library/x9wa4512.aspx[^]

                Appu.. "If you judge people, you have no time to love them."

                T Offline
                T Offline
                tanarnelinistit
                wrote on last edited by
                #9

                Maybe i'm a bit stupid but looking at your link still let me confused. I still don't get what am I doing wrong.

                1 Reply Last reply
                0
                • T tanarnelinistit

                  The loop should continue until I have non-space caractert e.g. szBuffer[0] != ' ' or szBuffer[0] != '\r', well, it doesn't...

                  Steve EcholsS Offline
                  Steve EcholsS Offline
                  Steve Echols
                  wrote on last edited by
                  #10

                  Yeah, I was referring to the post "It is wrong"...


                  - S 50 cups of coffee and you know it's on!

                  • S
                    50 cups of coffee and you know it's on!
                    Code, follow, or get out of the way.
                  1 Reply Last reply
                  0
                  • T tanarnelinistit

                    Hello i'm trying to use this do-while loop but it seems that it doesn't work the way I like it to: char szBuffer[18]; do { serial.Read(szBuffer,nBuflen,&dwBytesRead); szBuffer[dwBytesRead] = '\0'; } while (isspace(szBuffer[0])==0);

                    Steve EcholsS Offline
                    Steve EcholsS Offline
                    Steve Echols
                    wrote on last edited by
                    #11

                    So, what's the real problem? Does the loop exit immediately? Could be a timing issue. It doesn't seem like you ever do anything with szBuffer, or maybe you left that code out. Everytime you call serial.Read, it's going to overwrite your szBuffer, and you'll lose what's in it, unless you copy it somewhere.


                    - S 50 cups of coffee and you know it's on!

                    • S
                      50 cups of coffee and you know it's on!
                      Code, follow, or get out of the way.
                    1 Reply Last reply
                    0
                    • T tanarnelinistit

                      The loop should continue until I have non-space caractert e.g. szBuffer[0] != ' ' or szBuffer[0] != '\r', well, it doesn't...

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #12

                      So what is the value of szBuffer[0] when the loop terminates?


                      "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                      "Judge not by the eye but by the heart." - Native American Proverb

                      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