/ ************************************************************************ * * Purpose: Extract the directory information from a file name. * * /etc/local/bin/fdmount --> fdmount * * This mimics the unix command 'basename'. * * Author: M J Leslie * Date: 29-Feb-96 * ************************************************************************/ #include <string.h> char *basename(const char *FullName); main() { char *FullName = "/usr/local/bin/fdmount"; printf("Full name is %s \n", FullName); printf("File name is %s \n", basename(FullName)); } /************************************************************************/ char *basename(const char *FullName) { static char *File; /* ... I guess DOS users will have to change the direction of ... the slash. */ File = strrchr(FullName, '/'); /* ... If no slashes have been found, Return the full file name */ if (File == NULL) { File = FullName; } else { File++; } return(File); }
file: /Techref/language/ccpp/Cref/EXAMPLES/basename.c, 1KB, , updated: 1998/1/27 10:23, local time: 2024/8/22 22:48,
18.118.1.93:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://piclist.com/tecHREF/language/ccpp/Cref/EXAMPLES/basename.c"> language ccpp Cref EXAMPLES basename</A> |
Did you find what you needed? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.