Wrapping FILE* with custom std::ostream

As Ben Voigt points out, you want to subclass streambuf. There are pages on the University of Southern California’s website which have the documentation, header, and source for a GNU implementation of a streambuf subclass (stdiobuf) that wraps a FILE*. It has some dependencies on the library it is a part of (GroovX), but those … Read more

Objective-C Wrapper for CFunctionPointer to a Swift Closure

I needed to define this callback: typedef void (*MIDIReadProc) ( const MIDIPacketList *pktlist, void *readProcRefCon, void *srcConnRefCon ); and I wanted to use Objective-C as least as possible. This was my approach: MIDIReadProcCallback.h #import <Foundation/Foundation.h> #import <AudioToolbox/AudioToolbox.h> typedef void (^OnCallback)(const MIDIPacketList *packetList); @interface MIDIReadProcCallback : NSObject + (void (*)(const MIDIPacketList *pktlist, void *readProcRefCon, void *srcConnRefCon))midiReadProc; … Read more

Differences between ServletResponse and HttpServletResponseWrapper?

BalusC’s answer is good, but it might be a little overwhelming if you’re just starting out. Put simply: SerlvetResponse and its extension, HttpServletResponse, are interfaces telling you what methods are available to call to do the things you need. In the normal course of working with Filters, Servlets, et al., you’ll use HttpServletResponse often to … Read more