please dont rip this site

Language Ccpp Cref Examples Basename.c

/ ************************************************************************
 * 
 * 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 09:23, local time: 2024/11/10 10:29,
TOP NEW HELP FIND: 
13.59.1.159:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://ecomorder.com/techref/language/ccpp/CREF/EXAMPLES/basename.c"> language ccpp CREF EXAMPLES basename</A>

Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .