Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function building
#2
Local str variables are automatically destroyed when the function returns. If you want to return local str variable, declare the function as str.

Code:
Copy      Help
function'str $fn
SYSTEMTIME st
str a
lpstr s=GetFileInfo(fn 0 0 0 &st 0 0 1)
a.format("%u/%u/%u" st.wMonth st.wDay st.wYear)
ret a

or pass b by reference (recommended):

Code:
Copy      Help
str b
Get_File_Date("C:\qm\desktop\monday.mp3" b)
Code:
Copy      Help
function $fn str&a
SYSTEMTIME st
GetFileInfo(fn 0 0 0 &st 0 0 1)
a.format("%u/%u/%u" st.wMonth st.wDay st.wYear)

or create member function str.Get_File_Date:

Code:
Copy      Help
str b
b.Get_File_Date("$desktop$\led.txt")
Code:
Copy      Help
function $fn
SYSTEMTIME st
GetFileInfo(fn 0 0 0 &st 0 0 1)
format("%u/%u/%u" st.wMonth st.wDay st.wYear)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)