Hi, On Sat, Dec 23, 2017 at 7:13 PM, Olivier Hallot <olivier.hal...@libreoffice.org> wrote: > HI > > Newbie seeking advice! > > I am trying to implement Kendy's idea of a temp file with some HTML > inside, I seek a piece of code to open a temp file, write contents in > it, close it. > > I started with > --------------- > OUString aExtension(".html"); > ::utl::TempFile aTempFile("newhelp", true, &aExtension, nullptr, > false ); > aTempFile.EnableKillingFile(); > -------------- > > But then How do I write a simple OUString ("hello world") inside it?
continued from your example... SvStream* pStream = aTempFile.GetStream(StreamMode::WRITE); pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8); pStream->WriteUnicodeOrByteText(OUString ("hello world")); pStream->Close(); aTempFile.CloseStream(); As you can see this converts the OUString to UTF8 when you write it. BTW. I didn't try to compile this, so it may be wrong :) > Thanks in advance. > Seasons Greetings! > Olivier Best Regards, Tomaž _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice