Date: Tue, 10 Feb 1998 13:34:41 +0200 (IST) From: Eli Zaretskii To: Richard Chappell cc: djgpp AT delorie DOT com Subject: Re: Randon Function In-Reply-To: <34dfe7b8.6111175@news.netaccess.co.nz> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 10 Feb 1998, Richard Chappell wrote: > >char * read_one_line( char *buf, int len, int seek_line, FILE *fp ) > >{ > [snip] > >} > > So if I wanted to use this function in a program, would I have: > > char *mypc; > mypc=read_one_line(&mypc, myLenWanted,myLineWanted,"data.txt"); No. FILE *fp is NOT a string! It is a pointer returned by `fopen'. So at least you should have said this: mypc=read_one_line(&mypc, myLenWanted,myLineWanted, fopen("data.txt", "r")); I would also check the value returned from `fopen', since it could be a NUL pointer if the file didn't exist, for example.