Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, January 2007
close function in unistd.h may conflict with QDialog's close function~


Message 1 in thread

Hi~

Now, I'm programming some hardware interface program which
should talk to a device driver by using some device file like,
'/dev/dev/*' in linux.

My problem is,
when I try to close some opened file through close() function, for instance,
/////////////////////////////////////////
int fd0;

fd0 = open("/dev/testBoard0",O_RDONLY);
..
..
close(fd0);
/////////////////////////////////////////

in a class inherited from QDialog,

complier complains like,
---------------------------------------------------------------------------------------------
error: no matching function for call to ‘ControlPanelDialog::close(int&)’
/usr/local/Trolltech/Qt-4.2.1/include/QtGui/qwidget.h:426: note:
candidates are: bool QWidget::close()
----------------------------------------------------------------------------------------------

So, how can I use the close() function of unistd.h in QDialog class?
is it impossible to use it?

Thanks

-Hong, manbok

--
 [ signature omitted ] 

Message 2 in thread

Hi,

as far as I remember, the functions in the unistd.h are defined in the
std name space. If it is so, you can call its functions with std::open()
and std::close().
I hope that helps.

Regards,
Falko

--- Original-Nachricht ---
Absender: Hong, ManBok
Datum: 18.01.2007 12:05
> Hi~
>
> Now, I'm programming some hardware interface program which
> should talk to a device driver by using some device file like,
> '/dev/dev/*' in linux.
>
> My problem is,
> when I try to close some opened file through close() function, for instance,
> /////////////////////////////////////////
> int fd0;
>
> fd0 = open("/dev/testBoard0",O_RDONLY);
> ..
> ..
> close(fd0);
> /////////////////////////////////////////
>
> in a class inherited from QDialog,
>
> complier complains like,
> ---------------------------------------------------------------------------------------------
> error: no matching function for call to ‘ControlPanelDialog::close(int&)’
> /usr/local/Trolltech/Qt-4.2.1/include/QtGui/qwidget.h:426: note:
> candidates are: bool QWidget::close()
> ----------------------------------------------------------------------------------------------
>
> So, how can I use the close() function of unistd.h in QDialog class?
> is it impossible to use it?
>
> Thanks
>
> -Hong, manbok
>
> --
> 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 3 in thread

Falko Buttler 쓴 글:
> Hi,
>
> as far as I remember, the functions in the unistd.h are defined in the
> std name space. If it is so, you can call its functions with std::open()
> and std::close().
> I hope that helps.
>
> Regards,
> Falko
>
>   
Thanks for your fast response, Falko~ :)

After I checked your advice, I tried with std::close(fd0). however,
the complier says,

controlpaneldialog.cpp:104: error: ‘close’ is not a member of ‘std’

:-(

maybe not that reason..

anyway, thanks, Falko~


-Hong, manbok

--
 [ signature omitted ] 

Message 4 in thread

Am Donnerstag, 18. Januar 2007 12:05 schrieb Hong, ManBok:
> So, how can I use the close() function of unistd.h in QDialog class?
> is it impossible to use it?
try to write 

::close( ...)

instead.

toby

Attachment:

Attachment: pgpASefwTFggQ.pgp
Description: PGP signature


Message 5 in thread

Tobias Doerffel 쓴 글:
> Am Donnerstag, 18. Januar 2007 12:05 schrieb Hong, ManBok:
>   
>> So, how can I use the close() function of unistd.h in QDialog class?
>> is it impossible to use it?
>>     
> try to write 
>
> ::close( ...)
>
> instead.
>
> toby
>   
Wow~ you're right !
It works clearly.

Thanks, toby :)


Regards,
Hong, manbok

--
 [ signature omitted ]