You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
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.
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?
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: