|
of_setlastwritedatetime
|
|
Full name
|
pfc_n_cst_filesrvhpux.of_setlastwritedatetime
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_setlastwritedatetime(string,date,time)
|
Name
|
Datatype
|
lb_Ret
|
boolean
|
lstr_Empty
|
os_filedatetime
|
lstr_FileInfo
|
os_fileopeninfo
|
lstr_FileTime
|
os_filedatetime
|
lstr_FindData
|
os_finddata
|
lul_handle
|
ulong
|
public function integer of_setlastwritedatetime (string as_filename, date ad_date, time at_time);//////////////////////////////////////////////////////////////////////////////
// Public Function: of_SetLastWriteDatetime
// Arguments: as_FileName The name of the file to be updated.
// ad_FileDate The date to be set.
// at_FileTime The time to be set.
// Returns: Integer
// 1 if successful,
// -1 if an error occurrs.
// Description: Set the Date/Time stamp on a file.
//////////////////////////////////////////////////////////////////////////////
// Rev. History: Version
// 6.0 Initial version
//////////////////////////////////////////////////////////////////////////////
// Copyright © 1996-1999 Sybase, Inc. and its subsidiaries. All rights reserved. Any distribution of the
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
boolean lb_Ret
ulong lul_handle
os_filedatetime lstr_FileTime, lstr_Empty
os_finddata lstr_FindData
os_fileopeninfo lstr_FileInfo
// Get the file information.
// This is required to keep the Last Access date from changing.
// It will be changed by the OpenFile function.
lul_handle = FindFirstFileA(as_FileName, lstr_FindData)
If lul_handle <= 0 Then Return -1
FindClose(lul_handle)
// Convert the date and time
If of_ConvertPBDatetimeToFile(ad_Date, at_Time, lstr_FileTime) < 0 Then Return -1
// Set the file structure information
lstr_FileInfo.c_fixed_disk = "~000"
lstr_FileInfo.c_pathname = as_FileName
lstr_FileInfo.c_length = "~142"
// Open the file
lul_handle = OpenFile ( as_filename, lstr_FileInfo, 2 )
If lul_handle < 1 Then Return -1
lb_Ret = SetFileTime(lul_handle, lstr_Empty, lstr_FindData.str_LastAccessTime, lstr_FileTime)
CloseHandle(lul_handle)
If lb_Ret Then
Return 1
Else
Return -1
End If
end function