polling streams

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Smith

    polling streams

    Hi all
    I need a way to poll the input standard stream if there is data to read
    from it. Is there any way ( standard )to do this?
    thank you for any help, much appreciated.
    /B

  • Noah Roberts

    #2
    Re: polling streams

    Bob Smith wrote:[color=blue]
    > Hi all
    > I need a way to poll the input standard stream if there is data to read
    > from it. Is there any way ( standard )to do this?[/color]

    There is no standard way. You will need to find a newsgroup particular
    to your operating system.[color=blue]
    > thank you for any help, much appreciated.
    > /B
    >[/color]


    --
    Noah Roberts
    - "If you are not outraged, you are not paying attention."

    Comment

    • Bob Smith

      #3
      Re: polling streams



      Noah Roberts wrote:
      [color=blue]
      > Bob Smith wrote:
      >[color=green]
      >> Hi all
      >> I need a way to poll the input standard stream if there is data to
      >> read from it. Is there any way ( standard )to do this?[/color]
      >
      >
      > There is no standard way. You will need to find a newsgroup particular
      > to your operating system.[/color]

      oh no, seems so basic.
      Is there somekind of "workaround ", I just need to poll and read a set of
      event objects from the cin, but I want the gui to work while reading.
      as for now the gui hangs, ( no surprise ) while the read object attempts
      to read. could this be done in another way perhaps?
      any ideas and help much appreciated

      /B

      Comment

      • Rolf Magnus

        #4
        Re: polling streams

        Noah Roberts wrote:
        [color=blue]
        > Bob Smith wrote:[color=green]
        >> Hi all
        >> I need a way to poll the input standard stream if there is data to
        >> read from it. Is there any way ( standard )to do this?[/color]
        >
        > There is no standard way.[/color]

        That's not right. There is a way: std::cin.rdbuf( )->in_avail()

        Comment

        • Noah Roberts

          #5
          Re: polling streams

          Rolf Magnus wrote:[color=blue]
          > Noah Roberts wrote:
          >
          >[color=green]
          >>Bob Smith wrote:
          >>[color=darkred]
          >>>Hi all
          >>>I need a way to poll the input standard stream if there is data to
          >>>read from it. Is there any way ( standard )to do this?[/color]
          >>
          >>There is no standard way.[/color]
          >
          >
          > That's not right. There is a way: std::cin.rdbuf( )->in_avail()
          >[/color]

          I stand corrected. Here I have been using select all this time...

          --
          Noah Roberts
          - "If you are not outraged, you are not paying attention."

          Comment

          • Bob Smith

            #6
            Re: polling streams



            Rolf Magnus wrote:
            [color=blue]
            > Noah Roberts wrote:
            >
            >[color=green]
            >>Bob Smith wrote:
            >>[color=darkred]
            >>>Hi all
            >>>I need a way to poll the input standard stream if there is data to
            >>>read from it. Is there any way ( standard )to do this?
            >>>[/color]
            >>There is no standard way.
            >>[/color]
            >
            > That's not right. There is a way: std::cin.rdbuf( )->in_avail()[/color]

            thhhhhaaaaaannn nnnkkkkkk YOU!
            have a nice day
            /B

            [color=blue]
            >
            >[/color]

            Comment

            • tom_usenet

              #7
              Re: polling streams

              On Wed, 15 Oct 2003 12:17:05 +0300, Bob Smith <bobsmith@jippi i.fi>
              wrote:
              [color=blue]
              >Hi all
              >I need a way to poll the input standard stream if there is data to read
              >from it. Is there any way ( standard )to do this?[/color]

              Sort of. You can see if there is any more data buffered using:

              is.rdbuf()->in_avail();

              If that's not enough, you're going to need platform specific functions
              like select or WaitFor*.

              Tom

              Comment

              Working...