/* the name DumpString is what tecplot uses in tecplot9/util/preplot/preplot.c see useful_lib.C for fwriteI() */ void DumpString(FILE *fp, char *str){ int i = 0; while (str[i] != '\0') fwriteI(fp,(int)str[i++]); fwriteI(fp,0); return; }
//**********(G-4)********************* largeInt add_primes(largeInt min,largeInt max) //store all prime no.s ranging (>min && <=max) and return last prime no. added to the file { //largeNum nmin,nmax,ntemp,nptemp; largeInt itemp,iptemp,irem,lprime,zero; div_result temp_result; fp=fopen("prime_tab.txt","r+"); zero.sign=0; zero.len=1; zero.line[0]='0'; lprime=zero; iptemp=increment1(min); printf("\n"); while(greaterthan(max,iptemp)==1) { rewind(fp); itemp=freadI(fp); while(!feof(fp)) { temp_result=divl(iptemp,itemp); if(Nequal_to_zero(temp_result.rem)==1) { break; } itemp=freadI(fp); if(feof(fp)==1) { fwriteI(iptemp,fp); lprime=iptemp; } } iptemp=increment1(iptemp); } return(lprime); }