On Sat, 24 Nov 2001 00:03, David Faure wrote: > On Friday 23 November 2001 07:40, Clarence Dang wrote: > > Sorry about the delayed response :( ... > > > > On Tue, 13 Nov 2001 22:19, David Faure wrote: > > > On Tuesday 13 November 2001 10:54, Clarence Dang wrote: > > > > Hello... > > > > > > > > As you may be aware, I'm developing an import fitler for KWord but I > > > > am completely new to KOffice, Linux and KDE. So I was wondering if > > > > anyone would be able to please answer some of my questions below: > > > > > > > > 1. It seems that I cannot call "bool KoStore::write( const char* > > > > _data, unsigned long _len )" more than once. I thought that it would > > > > have acted a bit like fwrite where you can call it more than once. I > > > > mean, if I can't call it more than once, I would have to accumulate > > > > all my output into one huge string and then call KoStore::write at > > > > the end. Isn't this hopelessly inefficient? > > > > > > You should be able to call write() more than once, there's no reason > > > why not. About the efficiency and the buffering... well, when writing, > > > KoStore has to buffer the data anyway :(. Can't be fixed until we ditch > > > tar.gz and go for something like zip - reason: the tar format requires > > > to write down the size of the data before writing the actual data... > > > So what's happening exactly ? Do you get any error... ? > > > > write () returns a different value (false ???) the second time it's > > called and doesn't seem to write anything at all. > > Yes, but does anything appear in the debug output, in the console where > you start kword ? Much code is calling write() more than once, so the > problem has to be more subtle than that (and I would guess, not in > KoStore). > After 3 hours, I finally tracked it down... It has nothing to do with calling write () more than once. It was because I didn't destruct my instance of KoStore (I thought that this would have been done automagically in the spirit of QT!) and so the outputted store was always 0 bytes long, since some uninitialisation hadn't taken place. So hint to developers: If you ever write: KoStore *outfile = new KoStore (QString (outfilename), KoStore::Write); remember to: outfile->close (); delete (outfile); // <-- I forgot this line!!! So, it was my fault :) Clarence _______________________________________________ koffice-devel mailing list koffice-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/koffice-devel