Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages
Started by Frank Eid
Thu, 24 Apr 2003 21:14
Filename problem solved!
Author: Frank Eid
Date: Thu, 24 Apr 2003 21:14
Date: Thu, 24 Apr 2003 21:14
13 lines
1245 bytes
1245 bytes
I've been puzzled for a while with the fact that there is no 'ExtractFileName' - type of function in the VCL that actually returns the name of a file WITHOUT the extension part. The solution is: AnsiString as,fn; as = "C:\\mydir\\myfile.ext" fn = ExtractFileName(as); // Get's "myfile.ext" fn = ChangeFileExt(fn,""); // Get's "myfile" Frank
Re: Filename problem solved!
Author: Remy Lebeau (TeamB)
Date: Thu, 24 Apr 2003 21:31
Date: Thu, 24 Apr 2003 21:31
12 lines
1403 bytes
1403 bytes
"Frank Eid" <frank@spi.no> wrote in message news:3ea85256$1@newsgroups.borland.com... > I've been puzzled for a while with the fact that there is no > 'ExtractFileName' - type of function in the VCL that actually > returns the name of a file WITHOUT the extension part. Not in the VCL itself, no. But the C library has fnsplit() which does that. It doesn't work for UNC paths, though. Gambit
Re: Filename problem solved!
Author: Frank Eid
Date: Thu, 24 Apr 2003 21:44
Date: Thu, 24 Apr 2003 21:44
11 lines
1383 bytes
1383 bytes
> Not in the VCL itself, no. But the C library has fnsplit() which does that. > It doesn't work for UNC paths, though. Yeah, but it need lot's of defining of char arrays (possible with memory alloc), it's a lot easier to just use the AnsiString functions... After the idea of using 'ChangeFileExt()' I've trashed the func i wrote using the 'fnsplit()'... Frank
Re: Filename problem solved!
Author: Remy Lebeau (TeamB)
Date: Thu, 24 Apr 2003 22:19
Date: Thu, 24 Apr 2003 22:19
15 lines
1445 bytes
1445 bytes
"Frank Eid" <frank@spi.no> wrote in message
news:3ea8594c$1@newsgroups.borland.com...
> Yeah, but it need lot's of defining of char arrays
> (possible with memory alloc)
Hardly any, actually. If all you want is the filename portion only, then
just pass that buffer in only and set everything else to NULL:
char filename[MAXFILE+1] = {0};
fnsplit("C:\\mydir\\myfile.ext", NULL, NULL, filename, NULL);
Gambit
Re: Filename problem solved!
Author: Frank Eid
Date: Fri, 25 Apr 2003 10:04
Date: Fri, 25 Apr 2003 10:04
7 lines
1301 bytes
1301 bytes
> char filename[MAXFILE+1] = {0};
> fnsplit("C:\\mydir\\myfile.ext", NULL, NULL, filename, NULL);
Ok. Smart. (I've never used it that way since i've created my own filename
class in wich all parameters allways was used...)
Frank.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads