1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 <2014> 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 <2014> 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: streamDevice output format question |
From: | Dirk Zimoch <[email protected]> |
To: | Mark Rivers <[email protected]> |
Cc: | "[email protected]" <[email protected]> |
Date: | Wed, 26 Nov 2014 11:17:58 +0100 |
Hi Mark,Unfortunately, StreamDevice cannot solve this at the moment. I use sprintf to format %f and thus StreamDevice can do what sprintf can do.
But you could write your own format converter in C++ and assign any unused format character for it. StreamDevice supports adding new format converters in a modular way.
There are more ridiculous formats in heaven and earth, Mark, Than are dreamt of in your philosophy. Dirk On 24.11.2014 23:54, Mark Rivers wrote:
Dirk and all, I have a device that requires a command of the following format: ratei NNNNN ml/h where NNNNN is a number that is exactly 5 characters long including the decimal point. For example if the rate is 9 then: ratei 9.000 ml/h If the rate is 10 then the string must be ratei 10.00 ml/h If one sends 10.000 (six characters) the command is rejected. Is there a way to achieve this with streamDevice? I can’t use the field width flag, since that just sets a minimum field width. I need to set a maximum field width. I realize this is a ridiculous behavior for a device, but I need to deal with it. Thanks, Mark