PDA

View Full Version : problem of how to get drive



jyoti
30th November 2006, 07:57
hi all
i had made a function having name ReadDisk(/some arguments/)(already having code)
which read the sectors of hard disk
now i wanna use this function in another fuction rdrive() in qt4.2
and as i press the read drive button from form then rdrive()
function read whole drive in hard disk

so plz do tell me as soon as posible that how in qt one function can use the another function


i mean like
int ReadDrive(/some args/)
{
//some statements
}

void MainWindow :: rdrive()
{
//wht should be coded that i can use ReadDrive??
}

jpn
30th November 2006, 08:17
Do you notice something in common in the following posts?

Btw, how is this related to Qt Designer?

PS. This has nothing to do with Qt Designer. Thread moved.

PS. once again this has nothing to do with Qt Designer which is a tool for designing and building graphical user interfaces.

And what does it have to do with Qt Designer?

Please, don't ask questions that have nothing to do with Qt Designer in Qt Designer section and search the docs before you ask a question.

sunil.thaha
30th November 2006, 08:19
With all due respect :rolleyes:

It has got nothing to do with Qt ? The question is how to call function within another ?
Please go through this link http://newdata.box.sk/bx/c/htm/ch05.htm

Incase the function is in a .c file; then you have to declare it as extern " C " somewhat like this
OriginalHeader.h



void readDrive( /*blah blah*/ );
then change it to
ChangedHeader.h ( note: need not chage the header name )


#ifdef __cplusplus
extern "C" {
#endif

void readDrive( /*blah blah*/ );

#ifdef __cplusplus
};
#endif
Rest of the code will remain the same

jyoti
30th November 2006, 10:03
to mr. jpn Expert
i simply askd the question related with designer
tell me one thing pushbutton (created in designer) is not used or property of designer...so what i put wrong on wrong place...y didnot its related to QT designer ...n i had read the docs bt it is not the complete solution so asking by forum...

jacek
30th November 2006, 10:08
Just invoke that function from rdrive():

void MainWindow::rdrive()
{
// ...
int something = readDrive( ... );
// use something
}
If it isn't what you were asking for, please, clarify your question.

sunil.thaha
30th November 2006, 12:19
tell me one thing pushbutton (created in designer) is not used or property of designer...so what i put wrong on wrong place...y didnot its related to QT designer
In that case every thread in this forum should appear in Designer section, after all does it make any difference if you use designer or hand code it. Designer section is for those questions related to designer ( pretty clear huh );). Suppose you are facing difficulty using designer. or may be setting layout in designer or Being not able to find something in designer.
You can go through those valid posts in the designer section and see how it relates


...n i had read the docs Great !!


bt it is not the complete solution so asking by forum... what is not complete ? The doc is not intended to teach you C++

wysota
30th November 2006, 14:18
Peace guys! Peace among Christians (and all others as well)!