Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Readbyte() blocking or non-blocking on windows?

$
0
0

Unless the contrary is said all the functions should behave the same in all the platforms.

In the 0.9 the code comments documentation says:

    /// \brief Reads and returns a single byte from the requested device.
    ///
    /// ~~~~{.cpp}
    /// ofSerial mySerial;
    /// mySerial.setup(0, 57600);
    ///
    /// int myByte = mySerial.readByte();
    ///
    /// if ( myByte == OF_SERIAL_NO_DATA ){
    ///     printf("no data was read");
    /// } else if ( myByte == OF_SERIAL_ERROR ){
    ///     printf("an error occurred");
    /// } else {
    ///     printf("myByte is %d", myByte);
    /// }
    /// ~~~~
    ///
    /// \returns The single byte as integer. If there is no data it will return
    /// `OF_SERIAL_NO_DATA`, and on error it returns `OF_SERIAL_ERROR`

so yes readByte will return immediately and will return OF_SERIAL_NO_DATA if no data is available. if windows doesn't behave like that then it's a bug.

this documentation comments are still not integrated in the web page documentation since the official docs still refer to 0.8.4 where it wasn't present yet. you can also contribute to the documentation by editing the docs through the edit in github that you can find in every docs section


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>