GetFullPathName

Share your advanced PureBasic knowledge/code with the community.
netmon
User
User
Posts: 12
Joined: Sun Jul 27, 2003 4:29 pm

GetFullPathName

Post by netmon »

Code: Select all

OpenConsole()

;PathBuffer.s = "" ; uncomment this and the full path works ???
PathBuffer = AllocateMemory(0,255,0) ;this does not work for some  ???reason
FileName$ = "client.db"

OpenLibrary(0,"kernel32.dll")

result.w = CallFunction(0,"GetFullPathNameA", FileName$,255,@PathBuffer,NULL)

PrintN("String Count: "+Str(result))
PrintN("File path is: "+PeekS(@PathBuffer,result))
Input()


CloseLibrary(0)
CloseConsole()
End
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

Wouldn't it be easier to do this...

Code: Select all

Buffer$=Space(512)
FileName$="client.db"
 
GetFullPathName_(FileName$,Len(Buffer$),@Buffer$,@FilePart)
 
Debug PeekS(Buffer$)
Debug PeekS(FilePart)
Image Image
netmon
User
User
Posts: 12
Joined: Sun Jul 27, 2003 4:29 pm

Post by netmon »

After I did it, I realized this and didnt feal like updating lol.. but yes that is actually.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Post by Andre »

Anyone have a MacOS-compatible solution? Thanks :)
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Post by WilliamL »

@Andre

This has been discussed several times with several solutions.

http://www.purebasic.fr/english/viewtopic.php?t=38495
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
Post Reply