Function pointer and ofstream

Hello! I'm trying to create a function pointer to a member of std::ofstream and get an error. Here's the code:

1
2
3
4
5
6
7
8
9
10
int main() {

	ofstream bout;
	bout.open("bina.dat");
	void (*funcp)(const char*, streamsize) = NULL;    
	funcp = &bout.write(); 

	bout.close();
	return 0;
}


The error is: "no matching function for call to 'std::basic_ofstream<char>::write()' ." Any ideas?
Last edited on
You are way off the mark.

Here is an excellent tutorial on function pointers
http://www.digilife.be/quickreferences/PT/The%20Function%20Pointer%20Tutorials.pdf
Learn the syntax
bout.write(); is a call
void (*funcp)(const char*, streamsize) is not the correct prototype for a member function
Haha! Thanks guys
Topic archived. No new replies allowed.