Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 24th, 2006, 5:46 PM   #1
Edgar
Programmer
 
Edgar's Avatar
 
Join Date: May 2006
Location: Bathroom
Posts: 43
Rep Power: 0 Edgar is on a distinguished road
How to call normal "write" function inside a class

simple problem but I cannot figure out how to solve it:
I have a class "Foo" which has a method "write(string str)".
Inside this method I want to call the normal write function as defined in unistd.h:
write(int fd, const void *buf, size_t count)

I get the following compiler error:
error: no matching function for call to ‘Foo::write(int&, const char*&, size_t)

So the compiler (gcc 4.1) wants to call "Foo::write" instead of "write".
How can I specify to call the normal write function?
Edgar is offline   Reply With Quote
Old May 24th, 2006, 6:35 PM   #2
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 261
Rep Power: 4 Cache is on a distinguished road
Well, you could just change the name of your member function for one. And/or prefix the fuction call with :: which will resolve to global scope.
Cache is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:50 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC