FileAttr
Retrieves and changes the attributes of a file in memory
Download

FileAttr (49 KB)

 

Functions definition

external "CASL_FileAttr";
#
#---------------------------------------------------------
function dm_GetFileAttr(string FileName) as numeric;
# FileName : Name of the File in RAM or ROM
#            if set to "": current running application
# Return value >= 0: Attributes of FileName
#               < 0: abs(return value) = Error code (see list below)

#
#---------------------------------------------------------
function dm_SetFileAttr(string FileName, numeric Attr) as numeric;
# FileName : Name of the File in RAM or ROM
#            if set to "": current running application
# Return value = 0: no Error
#              > 0: Error code (see list below)
# If you try to change a ROM-based file, an error = 526 occurs

#
#---------------------------------------------------------
function dm_GetAppName as string;
# Retrieves the name of current running application
#
end_external;

#---------------------------------------------------------
function dm_IsSetFileAttr(numeric FileAttr, numeric xAttr) as numeric;
# Returns true, if xAttr is set within FileAttr
# Example : 
#    dm_IsSetFileAttr (dm_GetFileAttr("Launcher"), dmHdrAttrReadOnly)
# Tests, if the Launcher application has the Readonly attribute set (should 
# always be true, cause the Launcher is ROM-based!) 

  variables;
    numeric k;
  end;
  k = (FileAttr and xAttr);
  dm_IsSetFileAttr = (k = xAttr);
end;

# DataManager Error Codes: Basic = 512 
#
# dmErrMemError = 513;
# dmErrIndexOutOfRange = 514;
# dmErrInvalidParam = 515;
# dmErrReadOnly = 516;
# dmErrDatabaseOpen = 517;
# dmErrCantOpen = 518;
# dmErrCantFind = 519;
# dmErrRecordInWrongCard = 520;
# dmErrCorruptDatabase = 521;
# dmErrRecordDeleted = 522;
# dmErrRecordArchived = 523;
# dmErrNotRecordDB = 524;
# dmErrNotResourceDB = 525;
# dmErrROMBased = 526;
# dmErrRecordBusy = 527;
# dmErrResourceNotFound = 528;
# dmErrNoOpenDatabase = 529;
# dmErrInvalidCategory = 530;
# dmErrNotValidRecord = 531;
# dmErrWriteOutOfBounds = 532;
# dmErrSeekFailed = 533;
# dmErrAlreadyOpenForWrites = 534;
# dmErrOpenedByAnotherTask = 535;
# dmErrUniqueIDNotFound = 536;
# dmErrAlreadyExists = 537;
# dmErrInvalidDatabaseName = 538;
# dmErrDatabaseProtected = 539;
# dmErrDatabaseNotProtected = 540;
 

  © 2005 Ulrich Riepert / Authorized for posting at CASLSoft.com