Author Topic: CHDIR, MKDIR, RMDIR  (Read 108 times)

Robert

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
CHDIR, MKDIR, RMDIR
« on: August 04, 2020, 01:37:44 AM »
In the BCX Help file the Syntax description for the CHDIR, MKDIR, RMDIR functions arguments do not have parenthetical encapsulation.

Although, for the most simple usage this is not required, in many cases the BCX translator will not correctly parse these functions without encapsulation.

The Help file also does not show a return value for these functions.

I would like to change the CHDIR, MKDIR, RMDIR functions documentation to include parentheses and return values.

If you have comments about this change please express them.

Here is an MKDIR example that demonstrates the proposed changes. The example creates a BCX folder in the root directory of the drive in which the program is run.

Code: [Select]

DIM RetVal%
DIM Folder$
DIM DriveStr$
DriveStr$ = CHR$(GETDRIVE()+ 64)
Folder$ = "\BCX"
RetVal% = MKDIR(Folder$)
IF RetVal% = 0 THEN
  PRINT "MKDIR has created " & DriveStr$ & ":" & Folder$
END IF


MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: CHDIR, MKDIR, RMDIR
« Reply #1 on: August 04, 2020, 10:59:26 AM »
Robert -- I have some observations to share.

1) In your example, DriveStr$ is serving no purpose, as is. 
I suspect you meant to write RetVal% = MKDIR (DriveStr$ + Folder$)

2) In my testing, MKDIR ("BCX") creates a sub-folder in the current working directory.

3) Also, in my testing, MKDIR ("\BCX") always creates "BCX" in the root folder, regardless how deeply nested the command was invoked.  In other words, when I compile MKDIR ("\BCX") and run it from c:\temp\temp\temp\,
"BCX" is created in the root:  C:\BCX


Some elegant summary of these facts might do well in the Help file.

« Last Edit: August 04, 2020, 11:02:13 AM by MrBcx »

Robert

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
Re: CHDIR, MKDIR, RMDIR
« Reply #2 on: August 04, 2020, 12:00:04 PM »
Hi MrBCX:

My initial purpose was that I wanted to see if MKDIR ("\BCX") would create a folder in the root directory. The DriveStr$ was just an embellishment and reminder to indicate from which drive the program was running.

The return value provides a quick check on whether the folder was created. A double check using EXIST("\BCX") could also be used.