Command Prompt for Windows




argabs, _wargabs, _targabs

char *argabs(int index);
wchar_t *_wargabs(int index);
TCHAR *_targabs(int index);

Retrieve a command line argument index and convert it to an absolute path name.

Parameter Description
index Specifies which argument to retrieve. Specifying an index of 0 retrieves the current directory, as an absolute path name. Command line arguments start from an index of 1.

Returns

On success it returns the address of a NULL terminated string containing the absolute path name. On error it returns a NULL.

Comments

The absolute path name is stored in a static buffer and is over-written each time this function is called.

Absolute path names are made up of the following components :-

drive:\directory\filename

Component When not Specified
drive Current drive is used.
directory Current directory is used. Also relative directories are converted to absolute directories.
filename The previous directory name becomes the filename. Wildcard characters are allowed in filename.

See Also

argc, argv, argpath

Example

The following examples assume the current directory is C:\WINDOWS :-

Argument Full path
C: C:\WINDOWS.
C:\ C:\.
\DOS\ C:\DOS.
NOTEPAD.EXE C:\WINDOWS\NOTEPAD.EXE
*.EXE C:\WINDOWS\*.EXE
WHAT C:\WINDOWS\WHAT.
*.* C:\WINDOWS\*.*
. C:\WINDOWS.
.. C:\.