From: Richard Dawe Newsgroups: comp.os.msdos.djgpp Subject: Re: Extracting a directory name. Date: Mon, 18 Jun 2001 20:35:13 +0100 Lines: 22 Message-ID: <3B2E57F1.FCADB9AF@phekda.freeserve.co.uk> References: <7458-Mon18Jun2001185556+0300-eliz AT is DOT elta DOT co DOT il> NNTP-Posting-Host: modem-96.erythromycin.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg3.svr.pol.co.uk 992893346 29711 62.136.93.96 (18 Jun 2001 19:42:26 GMT) NNTP-Posting-Date: 18 Jun 2001 19:42:26 GMT X-Complaints-To: abuse AT theplanet DOT net X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586) X-Accept-Language: de,fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello. Graham Reeds wrote: > > Did you consider the possibility that strncpy might not null-terminate > > the resulting string in BaseDir? > > I did, and tried to append one with strcat, but that didn't solve the > problem. You won't be able to append a nul using strcat(). If there's no nul on the end of the string, how do you determine how long it is? (Hint: nul is the terminating character for a string in C.) You will have to write the nul in the char array yourself, e.g.: strncpy(dest, src, len); dest[len] = '\0'; HTH, bye, -- Richard Dawe http://www.phekda.freeserve.co.uk/richdawe/