#include #include char filedefaults[] = "/home/cc/tmiller/PERIODIC/"; display_file( char *filename) /* This routine types a file on the screen. The filename is passed as an arguement. */ { FILE *f1; /* file pointer */ int line_nr, key, i; char *ptr; char *malloc(); char line[80]; char *dall; dall = malloc( 100 ); strcpy (dall,filedefaults); strcat (dall,filename); /* open the file */ if((f1 = fopen(dall,"r")) == 0){ fprintf(stderr,"File: %s, not found\n",dall); fflush(stderr); free(dall); return; } free(dall); move(1,1); line_nr = 0; ptr = &line[0]; while (fgets(ptr,256,f1) != 0) { /* while(*ptr != '\n') { ++ptr; } *ptr = '\0'; ptr = &line[0]; */ if (line_nr >= 22) { line_nr = 0; addstr(ptr); /* Read a key stroke from the virtual keyboard (return to continue) */ beep(); refresh(); move(1,1); getch(key); clear(); if(key == '^Z') { goto done; } } else { addstr(ptr); /* write the line to the display */ line_nr = line_nr + 1; refresh(); } ptr = &line[0]; } /* Read a key stroke from the virtual keyboard (return to continue) */ getch(key); clear(); done: fclose(f1); return; }