This is Controller.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "Controller.h" #import "NXYView.h" #import<appkit/OpenPanel.h> #import <appkit/Panel.h> #import <streams/streams.h> #include <strings.h> @implementation Controller -nxyView:sender provideDataStream:(NXStream **)stream { NXStream *dataStream; char const *fileTypes[2] = {0,0}; // this type is all ASCII files (?) char fname[1024]; FILE *inputDATA; id openPanel = [OpenPanel new]; if ([openPanel runModalForTypes:fileTypes]) { strncpy(fname, [openPanel filename], 1024); if(( inputDATA = fopen(fname, "r")) == NULL) { NXRunAlertPanel("Open","Cannot open %s","OK",NULL,NULL,fname); return self; } } else return self; if ((dataStream = NXMapFile(fname, NX_READWRITE)) == NULL) { NXRunAlertPanel("Open", "Cannot open %s", "OK", NULL, NULL, fname); return self; } // Flush just to be safe, but there is probably not needed NXFlush(dataStream); fclose(inputDATA); *stream = dataStream; // Could be more direct with some modification return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.