From: ams AT ludd DOT luth DOT se (Martin Str|mberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: File I/O problem (newbie) Date: 22 Jul 1998 18:47:25 GMT Organization: University of Lulea, Sweden Lines: 38 Message-ID: <6p5c3t$s1j$1@news.luth.se> References: <35B63092 DOT 87C8C431 AT bc DOT sympatico DOT ca> NNTP-Posting-Host: my21.sm.luth.se To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jim Barlow (Jim_Barlow AT bc DOT sympatico DOT ca) wrote: : int readthefile (char *filename) { [Klippa, klapp, kluppit most of function.] : if (cur == &first) { // if so, there are no occurences of 'staredit' : return F_NOSTRINGS; : } : } : : long getfsize (FILE *fp) { : fseek (fp, 0, SEEK_END); : return ftell (fp); : } : : // adds a new item to the list and returns the new item : OFF_LIST *add_to_list (OFF_LIST *item, char *offset, int len) { : OFF_LIST *newlist; : : item->next = newlist = (OFF_LIST *)safemalloc (sizeof(OFF_LIST)); : newlist->offset = offset; : newlist->maxlen = len; : newlist->next = NULL; : : return newlist; : } : : For some reason, this function always returns F_NOWAVS even if the file consists : completely of "mystringmystringmystringmysting...." What's wrong here? Which function? If it's readthefile you mean, it's not returning F_NOWAVS but garbage as you don't have return if you reach the end of it. New Model Army, Small Town England, MartinS