Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 24th, 2006, 09:34 AM
Registered User
 
Join Date: May 2006
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, 05:24 PM
Authorized User
 
Join Date: Mar 2006
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, 10:44 AM
Authorized User
 
Join Date: Mar 2006
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, 02:19 PM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote





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 07:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.