C++ IO Library
-
I am using a C library which contains functions that use FILE* to send data to a file. Since I am writing my code in C++ and using ofstream, is there a way to gain access to the underlying FILE variable that is nested in ofstream to send to these functions? Any help will be gladly accepted. Justin Turney
-
I am using a C library which contains functions that use FILE* to send data to a file. Since I am writing my code in C++ and using ofstream, is there a way to gain access to the underlying FILE variable that is nested in ofstream to send to these functions? Any help will be gladly accepted. Justin Turney
-
I am using a C library which contains functions that use FILE* to send data to a file. Since I am writing my code in C++ and using ofstream, is there a way to gain access to the underlying FILE variable that is nested in ofstream to send to these functions? Any help will be gladly accepted. Justin Turney
-
I am using a C library which contains functions that use FILE* to send data to a file. Since I am writing my code in C++ and using ofstream, is there a way to gain access to the underlying FILE variable that is nested in ofstream to send to these functions? Any help will be gladly accepted. Justin Turney
Justin Turney wrote: is there a way to gain access to the underlying FILE variable that is nested in ofstream No, at least not in a portable way. You might cheat by hard-coding for a particular implementors specific version of the C++ library, but since that's a really ugly thing to do I obviously can do nothing but strongly recommend against it. Now, what you can do is drop the f requirement and use
ostream
. Then you could instantiate abasic_ostream
class that is implemented with a specialized streambuf that both uses and exposes the C stream interface (using FILE*). Since this is almost a FAQ, I refer you to google and/or comp.lang.c++.moderated for further information.