Hello all!
I'm experimenting with using a combination of a local function, XEQ() and a CALL routine, as a substitute for using a global function. I've got it working and I'm happy with the results, except for one issue. I can't figure out how to LOCALize the variable that returns the value from the CALL routine.
Here's an example:
! test
begin
extension$=".exe"
print "extension$ - before: ",extension$
file_ext$=fnget_extension$("myfile.jpg")
print "file_ext$: ",file_ext$
print "extension$ - after: ",extension$
end
!
def fnget_extension$(local filename$)=xeq("functions;get_extension",extension$,filename$,extension$) ! get the file extension from the specified filename
! functions
GET_EXTENSION:! get file extension from the specified filename
enter (filename$),extension$
extension$=""
p=pos("."=filename$,-1)
if p then extension$=filename$(p+1)
exit
Here's the output :
->run
extension$ - before: .exe
file_ext$: jpg
extension$ - after: jpg
->
I tried adding LOCAL to parameters in the XEQ() statement, but that results in an error 20.
Is there any way to prevent extension$ from being modified?
Regards,
Rob Leighton
Riverwood Enterprises Inc.