How to resolve the algorithm Program name step by step in the PowerBASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Program name step by step in the PowerBASIC programming language
Table of Contents
Problem Statement
The task is to programmatically obtain the name used to invoke the program. (For example determine whether the user ran "python hello.py", or "python hellocaller.py", a program importing the code from "hello.py".) Sometimes a multiline shebang is necessary in order to provide the script name to a language's internal ARGV. See also Command-line arguments Examples from GitHub.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Program name step by step in the PowerBASIC programming language
Source code in the powerbasic programming language
#INCLUDE "Win32API.inc"
'[...]
DIM fullpath AS ASCIIZ * 260, appname AS STRING
GetModuleFileNameA 0, fullpath, 260
IF INSTR(fullpath, "\") THEN
appname = MID$(fullpath, INSTR(-1, fullpath, "\") + 1)
ELSE
appname = fullpath
END IF
appname = EXE.NAMEX$
You may also check:How to resolve the algorithm Diversity prediction theorem step by step in the R programming language
You may also check:How to resolve the algorithm Anagrams step by step in the Phixmonti programming language
You may also check:How to resolve the algorithm Look-and-say sequence step by step in the BASIC programming language
You may also check:How to resolve the algorithm Empty program step by step in the bootBASIC programming language
You may also check:How to resolve the algorithm Monads/Maybe monad step by step in the Ruby programming language