Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Ada
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Directories; use Ada.Directories;
S : String := (Simple_Name (Command_Name));
#include <string.h>
#ifdef _WIN32
#define PATH_SEP '\\'
#else
#define PATH_SEP '/'
#endif

int main(int argc, char* argv[])
{
    char *s = strchr(argv[0], PATH_SEP);
    s = s ? s + 1 : argv[0];

    return 0;
}

New implementation...
< >
programming-idioms.org