Jump to content

DosChDir: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[image:legacy.png]]
{{Legacy
This function has been renamed to "[[OS2_API:CPI:DosSetCurrentDir|DosSetCurrentDir]]". [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false]
|RepFunc=[[DosSetCurrentDir]]
 
|Remarks=Renamed to "[[DosSetCurrentDir]]" in OS/2 2.0.[http://books.google.com/books?id=u7WbsmbttwYC&pg=PT372]
 
}}
==Description==
This call defines the current directory for the requesting process.
This call defines the current directory for the requesting process.


==Syntax==
==Syntax==
<PRE>
  DosChDir (DirName, Reserved)
  DosChDir


    (DirName, Reserved)
</PRE>
==Parameters==
==Parameters==
; DirName (PSZ) - input : Address of the ASCIIZ directory path name.  
;DirName (PSZ) - input : Address of the ASCIIZ directory path name.
 
;Reserved (ULONG) - input : Reserved and must be set to zero.
; Reserved (ULONG) - input : Reserved and must be set to zero.


==Return Code==
==Return Code==
 
;rc (USHORT) - return:Return code descriptions are:
rc (USHORT) - return
*0 NO_ERROR
 
*2 ERROR_FILE_NOT_FOUND
Return code descriptions are:
*3 ERROR_PATH_NOT_FOUND
 
*5 ERROR_ACCESS_DENIED
* 0     NO_ERROR
*8 ERROR_NOT_ENOUGH_MEMORY
* 2       ERROR_FILE_NOT_FOUND  
*26 ERROR_NOT_DOS_DISK
* 3       ERROR_PATH_NOT_FOUND
*87 ERROR_INVALID_PARAMETER
* 5       ERROR_ACCESS_DENIED
*108 ERROR_DRIVE_LOCKED
* 8       ERROR_NOT_ENOUGH_MEMORY  
*206 ERROR_FILENAME_EXCED_RANGE
* 26       ERROR_NOT_DOS_DISK
* 87       ERROR_INVALID_PARAMETER
* 108       ERROR_DRIVE_LOCKED
* 206       ERROR_FILENAME_EXCED_RANGE


==Remarks==
==Remarks==
Line 40: Line 31:
Programs running without the NEWFILES bit set are allowed to DosChDir to a non-8.3 filename format directory.
Programs running without the NEWFILES bit set are allowed to DosChDir to a non-8.3 filename format directory.


DosQSysInfo must be used by an application to determine the maximum path length supported by OS/2. The returned value should be used to dynamically allocate buffers that are to be used to store paths.  
[[DosQSysInfo]] must be used by an application to determine the maximum path length supported by OS/2. The returned value should be used to dynamically allocate buffers that are to be used to store paths.  


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSFILEMGR
#define INCL_DOSFILEMGR
Line 49: Line 40:
USHORT  rc = DosChDir(DirName, Reserved);
USHORT  rc = DosChDir(DirName, Reserved);


PSZ             DirName;      /* Directory path name *
PSZ     DirName;      /* Directory path name *
ULONG           0;            /* Reserved (must be zero) */
ULONG   0;            /* Reserved (must be zero) */


USHORT           rc;            /* return code */
USHORT rc;            /* return code */
</PRE>
</PRE>
===MASM===
<PRE>
EXTRN  DosChDir:FAR
INCL_DOSFILEMGR    EQU 1


PUSH@  ASCIIZ  DirName    ;Directory path name string
PUSH  DWORD  0          ;Reserved (must be zero)
CALL  DosChDir
Returns WORD
</PRE>
==Example Code==
This example changes directories to \os2\system.  
This example changes directories to \os2\system.  
<PRE>
<PRE>
Line 66: Line 69:
   rc = DosChDir(PATH, RESERVED);
   rc = DosChDir(PATH, RESERVED);
</PRE>
</PRE>
===MASM Binding===
<PRE>
EXTRN  DosChDir:FAR
INCL_DOSFILEMGR    EQU 1
PUSH@  ASCIIZ  DirName      ;Directory path name string
PUSH  DWORD  0            ;Reserved (must be zero)
CALL  DosChDir
Returns WORD
</PRE>
==Related Functions==
*


[[Category:The OS/2 API Project]]
[[Category:Dos16]]

Latest revision as of 00:28, 5 October 2023

Legacy Function Warning
It is recommended to use a newer replacement for this function.
Replacement: DosSetCurrentDir
Remarks: Renamed to "DosSetCurrentDir" in OS/2 2.0.[1]

This call defines the current directory for the requesting process.

Syntax

DosChDir (DirName, Reserved)

Parameters

DirName (PSZ) - input
Address of the ASCIIZ directory path name.
Reserved (ULONG) - input
Reserved and must be set to zero.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 2 ERROR_FILE_NOT_FOUND
  • 3 ERROR_PATH_NOT_FOUND
  • 5 ERROR_ACCESS_DENIED
  • 8 ERROR_NOT_ENOUGH_MEMORY
  • 26 ERROR_NOT_DOS_DISK
  • 87 ERROR_INVALID_PARAMETER
  • 108 ERROR_DRIVE_LOCKED
  • 206 ERROR_FILENAME_EXCED_RANGE

Remarks

The directory path is not changed if any member of the path does not exist. The current directory changes only for the requesting process.

For FSDs, the case of the current directory is set according to the DirName passed in, not according to the case of the directories on disk. For example, if the directory "c:\bin" is created and DosChDir is called with DirName "c:\bin", the current directory returned by DosQCurDir will be "c:\bin".

Programs running without the NEWFILES bit set are allowed to DosChDir to a non-8.3 filename format directory.

DosQSysInfo must be used by an application to determine the maximum path length supported by OS/2. The returned value should be used to dynamically allocate buffers that are to be used to store paths.

Bindings

C

#define INCL_DOSFILEMGR

USHORT  rc = DosChDir(DirName, Reserved);

PSZ     DirName;       /* Directory path name *
ULONG   0;             /* Reserved (must be zero) */

USHORT  rc;            /* return code */

MASM

EXTRN  DosChDir:FAR
INCL_DOSFILEMGR     EQU 1

PUSH@  ASCIIZ  DirName     ;Directory path name string
PUSH   DWORD   0           ;Reserved (must be zero)
CALL   DosChDir

Returns WORD

Example Code

This example changes directories to \os2\system.

#define INCL_DOSFILEMGR

#define PATH "\\os2\\system"
#define RESERVED 0L

USHORT rc;

   rc = DosChDir(PATH, RESERVED);