function n = pnm_getint( file ) # # PNM_GETINT(file) - read an integer from a pnm file # # file : file id for open file # # read past white space while ( 1 ) ch = pnm_getc( file ); if ( index( " \t\n\r", ch ) == 0 ) break; endif endwhile if ( ~isdigit(ch) ) error( "pnm file format error" ); endif i = 0; while ( 1 ) i = i * 10 + str2num(ch); ch = pnm_getc( file ); if ( ~isdigit(ch) ) break; endif endwhile n = i; endfunction