Menu

String handling in Genode framework

2015-04-11
2015-04-13
  • Duss Pirmin

    Duss Pirmin - 2015-04-11

    Hello

    I'm currently writing a generalized trace tool, which can send the trace information through a terminal connection.
    To build the text that are sent to the terminal, I need to build some strings, that are a concatenation of some sub strings (also some integers).
    Should I expand the Genode::String class or is there already a way to do this, that I have overlooked.

    Best Regards
    Pirmin

     
  • Norman Feske

    Norman Feske - 2015-04-13

    Hi Pirmin,

    would Genode::snprintf(dst, sizeof(dst), "%s%s", string1, string2) do the trick for you? You can find the corresponding header file at repos/base/include/base/snprintf.h.

    The Genode::String class is not meant to evolve into a fully-fledged string-handling facility. It does merely exist to accommodate our common use case of storing a string buffer as a member of an object. For a more complete string-handling library, let me recommend the use of the standard C++ library. In Genode, this library is provided by the libports repository and can be prepared via the stdcxx port.

    Cheers
    Norman

    PS: Would you consider posting questions like this to the Genode mailing list? This way, your questions would get a better exposure to all of the regular Genode developers, which are not monitoring this forum. You can find the mailing list here: http://genode.org/community/mailing-lists

     
  • Duss Pirmin

    Duss Pirmin - 2015-04-13

    Hi Norman

    snprintf will do it for me, this was the first thing I was looking for, but didn't find it.

    I will post further questions to the mailing list.

    Best regards
    Pirmin

     

Log in to post a comment.