File System Operations
|
|
|
Beginning from version 2.1 IXFile provides functionality for basic file system operations, performed on individual files
at the operating system level. With CopyFile, MoveFile
and DeleteFile developers can perform copying, moving and deleting files as expected.
CheckFile is also available for checking file existence and optionally retrieving its attributes.
GetFolder can be used whenever name of special system folder is required:
Windows root and system folders, temporary, current or application folder. Supporting methods MakePath
and SplitPath are provided to simplify path manipulations like merging, splitting and expanding paths.
Examples
C++
int main(int, char**)
{
IFile ixf;
long attr, exists;
char tname[_MAX_FNAME], fname[_MAX_PATH], filename[_MAX_PATH], path[_MAX_PATH];
ixf.SetLicenseKey("YOURLICENSEKEY");
strcpy(tname,"test.dat");
ixf.GetFolder(IXF_FOLDER_TEMP,path,_MAX_PATH);
ixf.MakePath(path,tname,filename,_MAX_PATH);
exists = ixf.CheckFile(filename,&attr);
if(exists == 0 || (exists > 0 && (attr & IXF_FILE_ARCHIVE) == 0))
{
ixf.GetFolder(IXF_FOLDER_EXEC,path,_MAX_PATH);
ixf.MakePath(path,tname,fname,_MAX_PATH);
ixf.CopyFile(fname,filename);
}
.
.
.
ixf.DeleteFile(filename);
return(0);
}
BASIC
Sub Main()
Dim ixf As IXFile
Dim filename As String, fname As String, tname As String
Dim attr As Long, exists As Long
Set ixf = New IXFile
ixf.SetLicenseKey "YOURLICENSEKEY"
tname = "test.dat"
filename = ixf.MakePath(ixf.GetFolder(IXF_FOLDER_TEMP),tname)
exists = ixf.CheckFile(filename,attr)
If(exists = 0 Or (exists > 0 And (attr And IXF_FILE_ARCHIVE) = 0)) Then
fname = ixf.MakePath(ixf.GetFolder(IXF_FOLDER_EXEC),tname)
ixf.CopyFile fname,filename
End If
.
.
.
ixf.DeleteFile filename
End Sub
See Also
CheckFile,
CopyFile,
MoveFile,
DeleteFile,
GetFolder,
MakePath,
SplitPath