forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using GETFULLPATHNAME Win 32 API

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Jan 26, 2016 6:30 pm    Post subject: Using GETFULLPATHNAME Win 32 API Reply with quote

I'm using the WIn32API call to determine the full (not relative) path name to a file. I have that working but ran across something I don't understand when trying to reconcile the MSDN description of the call and the implementation with FTN95.

Specifically, the FTN95 fourth parameter is specified as a 'REF'.
Quote:

STDCALL GETFULLPATHNAME 'GetFullPathNameA' (STRING,VAL,STRING,REF &
&):INTEGER*4

The MSDN description of what should be there is:
Quote:
lpFilePart [out]

A pointer to a buffer that receives the address (within lpBuffer) of the final file name component in the path.

This parameter can be NULL.

If lpBuffer refers to a directory and not a file, lpFilePart receives zero.


I'm trying to understand what this REF actually returns relative to the description given in the MSDN Win 32 API descriptions.

Any ideas?
Back to top
View user's profile Send private message Visit poster's website
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Tue Jan 26, 2016 7:56 pm    Post subject: Reply with quote

In C terms, the 3rd and 4th arguments are of type LPCSTR and LPCSTR *; the 3rd argument is an address that is known just before calling the Windows function. The fourth argument is the address of an address. The value of *lpFilePart is undefined/immaterial at entry, and Windows returns a pointer in lpFilePart. On the other hand, the value of the third argument must be set at entry and is not changed by the call.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Jan 26, 2016 10:12 pm    Post subject: Reply with quote

... so it (Ipfilepart or REF) just tells where the file NAME starts ? so it can be retrieved seperately if needed I suppose ?
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Tue Jan 26, 2016 11:20 pm    Post subject: Reply with quote

You could just try:
INQUIRE (UNIT=LU5, NAME=INFILE)

With FTN95 this will return the full path name, although this does not with some other compilers.
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Wed Jan 27, 2016 12:17 am    Post subject: Reply with quote

Thanks.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Wed Jan 27, 2016 9:23 am    Post subject: Reply with quote

Code:
program myprog
stdcall GetFullPathName 'GetFullPathNameA'(string,val,string,ref):integer
integer r
character(256) buffer
r = GetFullPathName("myprog.exe",256,buffer,core4(0))
if(r > 0) print*, buffer(1:r)
end
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group