www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/18/12:45:16

From: "Graham Reeds" <grahamr AT ntlworld DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <u0pX6.32176$9t5 DOT 2935940 AT news6-win DOT server DOT ntlworld DOT com> <7458-Mon18Jun2001185556+0300-eliz AT is DOT elta DOT co DOT il>
Subject: Re: Extracting a directory name.
Lines: 21
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <SYpX6.32438$9t5.2956364@news6-win.server.ntlworld.com>
Date: Mon, 18 Jun 2001 17:24:09 +0100
NNTP-Posting-Host: 213.104.34.75
X-Complaints-To: abuse AT ntlworld DOT com
X-Trace: news6-win.server.ntlworld.com 992881586 213.104.34.75 (Mon, 18 Jun 2001 17:26:26 BST)
NNTP-Posting-Date: Mon, 18 Jun 2001 17:26:26 BST
Organization: ntlworld News Service
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> 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.

> (Btw, there are library functions to do this, called `basename' and
> `direname'.  They are better than your code, because they also support
> forward slashes and file names like d:foo.)

I've never heard of basename and/or dirname.  They work fine, though a
forward slash causes a SISEGV like my code did.  How portable are these?
I'm looking to porting these to Win32 + MSVC.  Looking ahead I'm going to
have hosts of fun with findfirst(), findnext(), getcwd(), etc., and
considering MSDN is about as helpful as platearmour in a thunderstorm...:-(

--

Thanks, Graham Reeds.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019