[Libreoffice] How to write debug output to console or file?

Mattias Johnsson m.t.johnsson at gmail.com
Fri Oct 29 03:57:25 PDT 2010


Great, that's just what I need. Thanks!

On 29 October 2010 18:52, Cedric Bosdonnat <cedric.bosdonnat.ooo at free.fr> wrote:
> Hi Mattias,
>
> On Fri, 2010-10-29 at 15:49 +1100, Mattias Johnsson wrote:
>> To help with debugging, it'd be very useful for me to be able to write
>> out variable values from within the code. Writing to the console or a
>> file would be fine.
>
> Writing to the console using fprintf of std:: is possible. I usually
> output on the error stream for the debugging purposes.
>
>> std::cout doesn't work with any of the internal (unicode) string types
>> like OUString. Is there a way to cast them to something that cout can
>> deal with, or is there some logger that can write these strings to a
>> file?
>
> The problem here is to get a C string from them: here are some examples:
>  * from OUString:
>    rtl::OUStringToOString( sOUStr, RTL_TEXTENCODING_UTF8 ).getStr()
>
>  * from String / UniString
>    ByteString( sToolStr, RTL_TEXTENCODING_UTF8 ).GetBufferAccess()
>
> I typed those without checking the case... I hope it's OK, otherwise,
> just check the code for the correct syntax.
>
> Regards,
>
> --
> Cédric Bosdonnat
> LibreOffice hacker
> http://documentfoundation.org
> OOo Eclipse Integration developer
> http://cedric.bosdonnat.free.fr
>
>
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>


More information about the LibreOffice mailing list