Qt-interest Archive, December 2006
Writing to file at specific location
Message 1 in thread
Hi,
I'm trying to write 1 kb at start of file, file size is 5mb. I'm using QFile
object, it truncate file to 1kb. I want to keep rest of file as it is. I
only want to change initial 1kb. How can I do this?
I wan to replace 1kb of file.
--
[ signature omitted ]
Message 2 in thread
Hello Sharique,
you can simple jump to a specific position in a file by calling
QFile::seek(int). Now you can write your 1 kb of data at this position.
Regards,
Falko
--- Original-Nachricht ---
Absender: Sharique uddin Ahmed Farooqui
Datum: 01.12.2006 10:32
> Hi,
> I'm trying to write 1 kb at start of file, file size is 5mb. I'm using
> QFile object, it truncate file to 1kb. I want to keep rest of file as
> it is. I only want to change initial 1kb. How can I do this?
> I wan to replace 1kb of file.
>
> --
> Sharique uddin Ahmed Farooqui
> (C++/C# Developer, IT Consultant)
> http://www.sharique.managefolio.com/
> A revolution is about to begin.
> A world is about to change.
> And you and me are "the initiator".
--
[ signature omitted ]
Message 3 in thread
Hi everyone,
I want to extend my application with plug ins.
I followed the instructions on the documentation and exemples and
everything works fine. But it only allows the main application to talk
to the plug in and not the other way. My plug in needs information
recorded in the application structure, so I would like mu plug in to
have a pointer on the application.
I tried something like :
in the main app when loading the plug
plugin->setMainApp(this);
in the plug in
#include "mainApp.h"
void PlugIn::setMainApp(MainApp * a){
mainApp = a;
}
and in the plugin .pro file I add the path to the main application in
the INCLUDEPATH variable.
Plug in is created but when a function requiring a call to the main
application is executed The app crashes with symbol lookup error
(undefined symbol)
Does anyone have any idea of how I can do that?
Elise
--
[ signature omitted ]
Message 4 in thread
Elise Taillant wrote:
> Hi everyone,
>
> I want to extend my application with plug ins.
>
> I followed the instructions on the documentation and exemples and
> everything works fine. But it only allows the main application to talk
> to the plug in and not the other way. My plug in needs information
> recorded in the application structure, so I would like mu plug in to
> have a pointer on the application.
>
> I tried something like :
>
> in the main app when loading the plug
>
> plugin->setMainApp(this);
>
> in the plug in
>
> #include "mainApp.h"
> void PlugIn::setMainApp(MainApp * a){
>
> mainApp = a;
> }
>
>
> and in the plugin .pro file I add the path to the main application in
> the INCLUDEPATH variable.
>
> Plug in is created but when a function requiring a call to the main
> application is executed The app crashes with symbol lookup error
> (undefined symbol)
>
> Does anyone have any idea of how I can do that?
>
> Elise
Hello
I've done that for a prototype of an application that allows the plugin
to use some functions defined in a class of the main application for GUI
interaction.
I've done exactly what you did, well, almost, the plugin is a QObject
and I set the parent accordingly, but it works like a charm...
What is the symbol lookup error ??
Matthieu
P.S. : please start a new thread instead of answering to a precedent
mail, it's the second time you do this, and it's messing up the thread
in some mail applications.
--
[ signature omitted ]
Message 5 in thread
First sorry for the messing up.
My Plug in is a QObject. Do you mean that you do something like
plugIn->setParent(mainApp) ??
My error is
./MVStudio: symbol lookup error:
/home/movi/taillant/MVStudio/mvstudio/mvStudio/PlugIn/libpnp_plugintest.so:
undefined symbol: _ZN11MVStudioAPI15getNicknameListEv
where MVStudio is the name of my app, getNicknameList is the fucntion of
the main app which is called in the plug in.
Matthieu Brucher wrote:
> Elise Taillant wrote:
>
>> Hi everyone,
>>
>> I want to extend my application with plug ins.
>>
>> I followed the instructions on the documentation and exemples and
>> everything works fine. But it only allows the main application to
>> talk to the plug in and not the other way. My plug in needs
>> information recorded in the application structure, so I would like mu
>> plug in to have a pointer on the application.
>>
>> I tried something like :
>>
>> in the main app when loading the plug
>>
>> plugin->setMainApp(this);
>>
>> in the plug in
>>
>> #include "mainApp.h"
>> void PlugIn::setMainApp(MainApp * a){
>>
>> mainApp = a;
>> }
>>
>>
>> and in the plugin .pro file I add the path to the main application in
>> the INCLUDEPATH variable.
>>
>> Plug in is created but when a function requiring a call to the main
>> application is executed The app crashes with symbol lookup error
>> (undefined symbol)
>>
>> Does anyone have any idea of how I can do that?
>>
>> Elise
>
>
> Hello
>
> I've done that for a prototype of an application that allows the
> plugin to use some functions defined in a class of the main
> application for GUI interaction.
> I've done exactly what you did, well, almost, the plugin is a QObject
> and I set the parent accordingly, but it works like a charm...
> What is the symbol lookup error ??
>
> Matthieu
>
> P.S. : please start a new thread instead of answering to a precedent
> mail, it's the second time you do this, and it's messing up the thread
> in some mail applications.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 6 in thread
Elise Taillant wrote:
> First sorry for the messing up.
>
> My Plug in is a QObject. Do you mean that you do something like
> plugIn->setParent(mainApp) ??
> My error is
>
> ./MVStudio: symbol lookup error:
> /home/movi/taillant/MVStudio/mvstudio/mvStudio/PlugIn/libpnp_plugintest.so:
> undefined symbol: _ZN11MVStudioAPI15getNicknameListEv
>
> where MVStudio is the name of my app, getNicknameList is the fucntion of
> the main app which is called in the plug in.
It's logical, as the plugin is not linked to your application.
What I did is that every function that the plugin needs access to is
declared in a pure abstract class, and the plugin uses this class to
access the functions. The MainApp inherits from this abstract class, and
instead of getting a pointer to the MainApp, you get a pointer to your
abstract class.
This way, you can split efficiently your app, and even use your plugin
for other purposes, just by using a different class that inherits your
abstract class - for instance my plugin is used in conjunction with a
viewer and several simple questions can be asked to the user, but it
could be used with a non-GUI app that parses a file to get the answers
to the same questions -
If you want a tighter coupling between your plugin and your app, make it
a single application.
Matthieu
--
[ signature omitted ]
Message 7 in thread
Thank you, I'm going to try that. That's exactly the king of plug in I
want to develop.
Elise
Matthieu Brucher wrote:
> Elise Taillant wrote:
>
>> First sorry for the messing up.
>>
>> My Plug in is a QObject. Do you mean that you do something like
>> plugIn->setParent(mainApp) ??
>> My error is
>>
>> ./MVStudio: symbol lookup error:
>> /home/movi/taillant/MVStudio/mvstudio/mvStudio/PlugIn/libpnp_plugintest.so:
>> undefined symbol: _ZN11MVStudioAPI15getNicknameListEv
>>
>> where MVStudio is the name of my app, getNicknameList is the fucntion
>> of the main app which is called in the plug in.
>
>
> It's logical, as the plugin is not linked to your application.
> What I did is that every function that the plugin needs access to is
> declared in a pure abstract class, and the plugin uses this class to
> access the functions. The MainApp inherits from this abstract class,
> and instead of getting a pointer to the MainApp, you get a pointer to
> your abstract class.
> This way, you can split efficiently your app, and even use your plugin
> for other purposes, just by using a different class that inherits your
> abstract class - for instance my plugin is used in conjunction with a
> viewer and several simple questions can be asked to the user, but it
> could be used with a non-GUI app that parses a file to get the answers
> to the same questions -
> If you want a tighter coupling between your plugin and your app, make
> it a single application.
>
> Matthieu
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 8 in thread
On Friday, 1. December 2006 10:32, Sharique uddin Ahmed Farooqui wrote:
> Hi,
> I'm trying to write 1 kb at start of file, file size is 5mb. I'm using
> QFile object, it truncate file to 1kb. I want to keep rest of file as it
> is. I only want to change initial 1kb. How can I do this?
> I wan to replace 1kb of file.
Did you open it with QIODevice::ReadWrite?
-Rainer
--
[ signature omitted ]