home *** CD-ROM | disk | FTP | other *** search
- char *freadline(FILE *sourceFile)
- {
-
- static char copyBuffer[128];
- static char char1,char2;
- static int index,endofstring,dummyChar;
-
- index=0;
- endofstring=0;
- dummyChar=0;
- copyBuffer[0]=0;
-
- while(endofstring==0 && index<127)
- {
- char1=fgetc(sourceFile);
- if (feof(sourceFile))
- endofstring=-1;
-
- else if(char1==13)
- {
- char2=fgetc(sourceFile);
- if (char2!=10)
- ungetc(char2,sourceFile);
- endofstring=-1;
- }
- else if(char1==10)
- endofstring=-1;
- else
- {
- copyBuffer[index]=char1;
- index++;
- }
- }
-
- copyBuffer[index]=0;
- return(copyBuffer);
- };
-