Announcement

Collapse
No announcement yet.

Curdir$

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lance Edmonds
    replied
    CURDIR$ returns the current path, however many level deep it goes (AFAIK, it can be anywhere up to the O/S limit of 260 characters), for example:
    Code:
    FUNCTION PBMAIN
        CHDRIVE "I:"
        CHDIR "\WINNT\SYSTEM32"
        PRINT CURDIR$  ' "I:\WINNT\SYSTEM32"
        WAITKEY$
    END FUNCTION
    'Doing a Msgbox CurDir$ right here produces:
    'C:\PBDLL when I am in C:\PBDLL\Ncrypt
    This suggests that your app is at C:\PBDLL\NCRYPT.EXE rather than C:\PBDLL\NCRYPT\NCRYPT.EXE. Alternativelty, as this is launched from a 'shell', it may be that your parent app is not placing you where you expect to be - the current path does not have to be the same as the application path - a quick check with GetModuleFileName() will tell you this.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Scott Turchin
    started a topic Curdir$

    Curdir$

    Funny this came up in another thread, but I have an encryption program in PB/CC, works great, but then I thought, the same code is in a DLL I use, and I have a GUI version also...

    So, by sending the GUI version teh same commandline I can in essence have a command console version in PB/DLL without any Console requirements...

    So I ch eck for len(Command$), if it is > 0 Then I do this:


    Code:
    FileSpec is global as string
    
    If Len(Command$) Then
        'User typed ncrypt <filename> <keyNumber>
        FileSpec = CurDir$ + "\" + Parse$(Command$, Any ";, ", 1)
        KeyNum = Val(Parse$(Command$,Any ";, ",2))
    
        'Doing a Msgbox CurDir$ right here produces:
        'C:\PBDLL when I am in C:\PBDLL\Ncrypt
        Result = NcryptFile(0, _
                            FileSpec, _
                            KeySt,_
                            KeyNum,_
                            BitLevel)
        Exit Function
    End If
    
    
    Does CurDir$ Only read the mother directory?
    -------------
    Scott
    mailto:[email protected][email protected]</A>
Working...
X
😀
🥰
🤢
😎
😡
👍
👎