This is Mask.c in view mode; [Download] [Up]
/* Generated by Interface Builder */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "Mask.h" int openMask(char *file, mask *m) { FILE *fp; int i,j,k; int sz; char fullPath[500]; char *newfile; float val; if((fp = fopen(file,"r")) == NULL) return 0; fscanf(fp,"%d",&m->size); m->data = (float **)malloc(m->size*sizeof(float *)); for(k=0;k<m->size;k++) m->data[k] = (float *)malloc(m->size*sizeof(float)); for(i=0;i<m->size;i++) for(j=0;j<m->size;j++) fscanf(fp,"%f",&m->data[i][j]); fclose(fp); return 1; } int saveMask(char *file, mask *m) { FILE *fp; int i,j; int sz; char fullPath[500]; float **msk; if((fp = fopen(file,"w")) == NULL) return 0; fprintf(fp,"%d\n",m->size); for(i=0;i<m->size;i++) { for(j=0;j<m->size;j++) { fprintf(fp,"%f ",m->data[i][j]); } fprintf(fp,"\n"); } fclose(fp); return 1; }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.