Re: split a /path/filename into components
- From: Josef Moellers <josef.moellers@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 25 Aug 2006 12:39:15 +0200
Rikishi 42 wrote:
Eric wrote:
Is there a C library function that can take a path and break it into its
component parts? I think dos has one called fnsplit but i cant seem to
find an equal in the linux world
I'm working with Python mostly lately, so memory isn't fresh...
But wasn't there a strtok() function in C, that would split a string, based
on a given char ? Us '/' as that char, and you should be fine.
The strtok function has too many problems to be really usefull.
From the manual page:
Never use these functions. If you do, note that:
These functions modify their first argument.
These functions cannot be used on constant strings.
The identity of the delimiting character is lost.
The strtok() function uses a static buffer while parsing, so it's not thread safe. Use strtok_r() if this matters to you.
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
.
- Follow-Ups:
- Re: split a /path/filename into components
- From: Rikishi 42
- Re: split a /path/filename into components
- References:
- Re: split a /path/filename into components
- From: Rikishi 42
- Re: split a /path/filename into components
- Prev by Date: Re: split a /path/filename into components
- Next by Date: Re: what does 'bis' mean in RFC title?
- Previous by thread: Re: split a /path/filename into components
- Next by thread: Re: split a /path/filename into components
- Index(es):
Relevant Pages
|