Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 24th, 2006, 10:34 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to call normal "write" function inside a class

Hi,

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?

Greetings, Jonas

Reply With Quote
  #2 (permalink)  
Old May 24th, 2006, 06:24 PM
Authorized User
 
Join Date: Mar 2006
Location: Tucson, AZ, USA.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to skoob1152 Send a message via Yahoo to skoob1152
Default

Let me see your source code

Reply With Quote
  #3 (permalink)  
Old May 25th, 2006, 11:44 AM
Authorized User
 
Join Date: Mar 2006
Location: Tucson, AZ, USA.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to skoob1152 Send a message via Yahoo to skoob1152
Default

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.

Reply With Quote
  #4 (permalink)  
Old May 25th, 2006, 03:19 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx, the :: prefix is working fine for me!

Reply With Quote
Reply


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call javascript function from VB function vinod_yadav1919 VB How-To 0 February 13th, 2006 06:03 AM
Class library template does not exist - normal? redbaiter BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 3 April 1st, 2005 05:59 AM
Prb with js function call inside flash using XSL schander10 XSLT 3 September 14th, 2004 08:33 AM



All times are GMT -4. The time now is 12:34 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.