SDK
Miscellaneous

Functions

int SPI_FIL_open_filcat (const std::string &dir, const std::string &pattern)
 Creates the catalog of files contained in a directory
and who respond to the desired mask.
 
int SPI_FIL_get_filcat (std::string &fileName)
 Returns the current file of a catalog.
 
int SPI_FIL_get_size_filcat (double *fSize)
 Returns the size of the current file.
 
int SPI_FIL_close_filcat ()
 Closes file catalog.
 
int SPI_FIL_complet_name (const std::string &dirName, const std::string &fileName, std::string &fullName)
 Rebuilds a full file name from its name and directory.
 
int SPI_FIL_delete_file (const std::string &dirName, const std::string &fileName)
 Deletes a file.
 
int SPI_FIL_select_file (int mode, const std::string &ext, int flagMosaic, std::string &dir, std::string &name)
 Calls file browser to select a file.
 
int SPI_FIL_test_file (const std::string &dirName, const std::string &fileName, int mode)
 Checks the presence and attributes of a file or directory.
 
int SPI_FIL_copy_file (const std::string &dirIn, const std::string &filIn, const std::string &dirOut, const std::string &filOut)
 Copies a file.
 
int SPI_FIL_get_date_filcat (std::string &fDate)
 Returns the date of the current file.
 
int SPI_FIL_open_dircat (const std::string &dir, int mode)
 Builds a catalog of sub directories from a directory.
 
int SPI_FIL_get_first_dircat (std::string &dir)
 Returns the first directory of the catalog.
 
int SPI_FIL_get_dircat (std::string &dir)
 Returns the first sub directory of the catalog.
 
int SPI_FIL_close_dircat ()
 Closes the catalog of the directory.
 
int SPI_FIL_base_name (const std::string &fullName, std::string &dirName, std::string &fileName)
 Splits a full name to a directory and file name.
 
int SPI_FIL_new_extension (const std::string &fileIn, const std::string &ext, std::string &fileOut)
 Changes the file extension.
 
int SPI_FIL_remove_extension (const std::string &fileIn, std::string &fileOut)
 Removes the file extension.
 
int SPI_FIL_remove_tool_extension (const std::string &fileIn, std::string &fileOut)
 Removes the tool file extension (if filename is with a tool extension)
 
int SPI_FIL_CompressDirToZip (const std::string &dirName, const std::string &zipFile)
 Create a zip file with all files in a directory.
 
int SPI_FIL_create_dir (const std::string &dirName)
 Creates a directory.
 
int SPI_FIL_delete_dir (const std::string &dirName)
 Deletes a directory.
 
int SPI_FIL_select_directory (std::string &folder)
 Calls file browser to select a directory.
 
int SPI_FIL_get_extension (const std::string &fileName, std::string &ext)
 Returns supposed file extension.
 
int SPI_FIL_encrypt_file (const std::string &key, const std::string &dirName, const std::string &fileName)
 Encrypts the file.
 
int SPI_FIL_decrypt_file (const std::string &key, const std::string &dirName, const std::string &fileName)
 Decrypts the file.
 

Detailed Description

Miscellaneous utilities for files/directories management

Function Documentation

◆ SPI_FIL_base_name()

int SPI_FIL_base_name ( const std::string & fullName,
std::string & dirName,
std::string & fileName )

Splits a full name to a directory and file name.

Version
4.4
Parameters
[in]fullNamefull name of the file
[out]dirNamename of the directory
[out]fileNamename of the file
Returns
SPI_YES
ier := ICALL(SPI_FIL_base_name,'c:\cni\goev4_5\iso\ruban.txt',dirname,
filename);
{ dirname = 'c:\cni\goev4_5\iso', filename = 'ruban.txt' }
int SPI_FIL_base_name(const std::string &fullName, std::string &dirName, std::string &fileName)
Splits a full name to a directory and file name.
Definition sp_fil02.c:782

◆ SPI_FIL_close_dircat()

int SPI_FIL_close_dircat ( )

Closes the catalog of the directory.

Version
4.4
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_close_dircat);
int SPI_FIL_close_dircat()
Closes the catalog of the directory.
Definition sp_fil02.c:755
See also
SPI_FIL_open_dircat

◆ SPI_FIL_close_filcat()

int SPI_FIL_close_filcat ( )

Closes file catalog.

Version
4.4
Returns
SPI_YES
ier := ICALL(SPI_FIL_close_filcat);
int SPI_FIL_close_filcat()
Closes file catalog.
Definition sp_fil02.c:343
See also
SPI_FIL_open_filcat

◆ SPI_FIL_complet_name()

int SPI_FIL_complet_name ( const std::string & dirName,
const std::string & fileName,
std::string & fullName )

Rebuilds a full file name from its name and directory.

Version
4.4
Parameters
[in]dirNamename of the directory
[in]fileNamename of the file
[out]fullNamefull path name of the file
Returns
SPI_YES
ier := ICALL(SPI_FIL_complet_name,'c:\GO2cam_intl\GO2camV607\iso','ruban.txt'
,full_name);
{ full_name = 'c:\GO2cam_intl\GO2camV607\iso\ruban.txt' }
int SPI_FIL_complet_name(const std::string &dirName, const std::string &fileName, std::string &fullName)
Rebuilds a full file name from its name and directory.
Definition sp_fil02.c:370

◆ SPI_FIL_CompressDirToZip()

int SPI_FIL_CompressDirToZip ( const std::string & dirName,
const std::string & zipFile )

Create a zip file with all files in a directory.

Version
6.09
Parameters
[in]dirNameName of the files directory
[in]zipFilecomplete Name of the zip file
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_CompressDirToZip,'c:\iso','c:\tmp\zipfile.z);
int SPI_FIL_CompressDirToZip(const std::string &dirName, const std::string &zipFile)
Create a zip file with all files in a directory.
Definition sp_fil02.c:930

◆ SPI_FIL_copy_file()

int SPI_FIL_copy_file ( const std::string & dirIn,
const std::string & filIn,
const std::string & dirOut,
const std::string & filOut )

Copies a file.

Version
4.4
Parameters
[in]dirInname of the input directory
[in]filInname of the input file
[in]dirOutname of the output directory
[in]filOutname of the output file
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_copy_file,'c:\temp','ruban.txt','a:\','ruban.txt');
int SPI_FIL_copy_file(const std::string &dirIn, const std::string &filIn, const std::string &dirOut, const std::string &filOut)
Copies a file.
Definition sp_fil02.c:549

◆ SPI_FIL_create_dir()

int SPI_FIL_create_dir ( const std::string & dirName)

Creates a directory.

Version
4.4
Parameters
[in]dirNameName of the directory
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_create_dir,'c:\temp\newdir');
int SPI_FIL_create_dir(const std::string &dirName)
Creates a directory.
Definition sp_fil02.c:960

◆ SPI_FIL_decrypt_file()

int SPI_FIL_decrypt_file ( const std::string & key,
const std::string & dirName,
const std::string & fileName )

Decrypts the file.

Version
5.9
Parameters
[in]keykey to decrypt the file
[in]dirNamename of the directory
[in]fileNamename of the file
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_decrypt_file,'c:\temp','ruban.txt');
int SPI_FIL_decrypt_file(const std::string &key, const std::string &dirName, const std::string &fileName)
Decrypts the file.
Definition sp_fil02.c:1127

◆ SPI_FIL_delete_dir()

int SPI_FIL_delete_dir ( const std::string & dirName)

Deletes a directory.

Version
6.08
Parameters
[in]dirNameName of the directory
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_delete_dir,'c:\temp\newdir');
int SPI_FIL_delete_dir(const std::string &dirName)
Deletes a directory.
Definition sp_fil02.c:988

◆ SPI_FIL_delete_file()

int SPI_FIL_delete_file ( const std::string & dirName,
const std::string & fileName )

Deletes a file.

Version
4.4
Parameters
[in]dirNamename of the directory
[in]fileNamename of the file
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_delete_file,'c:\temp','ruban.txt');
int SPI_FIL_delete_file(const std::string &dirName, const std::string &fileName)
Deletes a file.
Definition sp_fil02.c:406

◆ SPI_FIL_encrypt_file()

int SPI_FIL_encrypt_file ( const std::string & key,
const std::string & dirName,
const std::string & fileName )

Encrypts the file.

Version
5.9
Parameters
[in]keykey to encrypte the file
[in]dirNamename of the directory
[in]fileNamename of the file
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_encrypt_file,'c:\temp','ruban.txt');
int SPI_FIL_encrypt_file(const std::string &key, const std::string &dirName, const std::string &fileName)
Encrypts the file.
Definition sp_fil02.c:1084

◆ SPI_FIL_get_date_filcat()

int SPI_FIL_get_date_filcat ( std::string & fDate)

Returns the date of the current file.

Version
4.4
Parameters
[out]fDatedate of file (format:jj/mm/aa hh:mn)
Returns
SPI_YES
ier := ICALL(SPI_FIL_get_date_filcat,date);
int SPI_FIL_get_date_filcat(std::string &fDate)
Returns the date of the current file.
Definition sp_fil02.c:590

◆ SPI_FIL_get_dircat()

int SPI_FIL_get_dircat ( std::string & dir)

Returns the first sub directory of the catalog.

Version
4.4
Parameters
[out]dirname of the directory
If dir equal nul => end of catalog
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_get_dircat,dir);
int SPI_FIL_get_dircat(std::string &dir)
Returns the first sub directory of the catalog.
Definition sp_fil02.c:712

◆ SPI_FIL_get_extension()

int SPI_FIL_get_extension ( const std::string & fileName,
std::string & ext )

Returns supposed file extension.

Version
5.5
Parameters
[in]fileNamefile name
[out]extsupposed file extension
Returns
SPI_YES
Pascal example
ier := ICALL(SPI_FIL_get_extension,'toto.txt',ext);
{ ext = 'txt' }
VB example
ier = GOE.SPI_FIL_get_extension("c:\tmp\toto.txt",ext)
'ext = "txt"
int SPI_FIL_get_extension(const std::string &fileName, std::string &ext)
Returns supposed file extension.
Definition sp_fil02.c:1046

◆ SPI_FIL_get_filcat()

int SPI_FIL_get_filcat ( std::string & fileName)

Returns the current file of a catalog.

Version
4.4
Parameters
[out]fileNameCurrent file name
If filename equal nul => End of catalog list
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_get_filcat,filename);
int SPI_FIL_get_filcat(std::string &fileName)
Returns the current file of a catalog.
Definition sp_fil02.c:279

◆ SPI_FIL_get_first_dircat()

int SPI_FIL_get_first_dircat ( std::string & dir)

Returns the first directory of the catalog.

Version
4.4
Parameters
[out]dirname of the directory
If dir equal nul => end of catalog
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_get_first_dircat,dir);
int SPI_FIL_get_first_dircat(std::string &dir)
Returns the first directory of the catalog.
Definition sp_fil02.c:673

◆ SPI_FIL_get_size_filcat()

int SPI_FIL_get_size_filcat ( double * fSize)

Returns the size of the current file.

Version
4.4
Parameters
[out]fSizesize of the file
Returns
SPI_YES
ier := ICALL(SPI_FIL_get_size_filcat,size);
int SPI_FIL_get_size_filcat(double *fSize)
Returns the size of the current file.
Definition sp_fil02.c:315

◆ SPI_FIL_new_extension()

int SPI_FIL_new_extension ( const std::string & fileIn,
const std::string & ext,
std::string & fileOut )

Changes the file extension.

Version
4.4
Parameters
[in]fileInInput file
[in]extnew extension of the file
[out]fileOutOutput file with a new extension
Returns
SPI_YES
ier := ICALL(SPI_FIL_new_extension,'toto.txt','iso',newfile);
{ newfile = 'toto.iso' }
int SPI_FIL_new_extension(const std::string &fileIn, const std::string &ext, std::string &fileOut)
Changes the file extension.
Definition sp_fil02.c:820

◆ SPI_FIL_open_dircat()

int SPI_FIL_open_dircat ( const std::string & dir,
int mode )

Builds a catalog of sub directories from a directory.

Version
4.4
Parameters
[in]dirname of the directory
[in]mode
  • SPI_FIL_CURR_CAT: Head catalog
  • SPI_FIL_TREE_CAT: Sub directory (tree)
Returns
SPI_YES / SPI_NO
Remarks
Don't forget to close the catalog after using
strcpy(dirname,'init');
ier := ICALL(SPI_FIL_open_dircat,'c:\cni\goev4_5\iso',SPI_FIL_CURR_CAT);
ier := ICALL (SPI_FIL_get_first_dircat,dirname);
WHILE ( dirname[0] <> chr(0) ) DO
BEGIN
ier := ICALL (SPI_FIL_get_dircat,dirname);
{ action with dirname }
END;
ier := ICALL(SPI_FIL_close_dircat);
int SPI_FIL_open_dircat(const std::string &dir, int mode)
Builds a catalog of sub directories from a directory.
Definition sp_fil02.c:623
See also
SPI_FIL_close_dircat

◆ SPI_FIL_open_filcat()

int SPI_FIL_open_filcat ( const std::string & dir,
const std::string & pattern )

Creates the catalog of files contained in a directory
and who respond to the desired mask.

Version
4.4
Parameters
[in]dirdirectory of the files
[in]patternfilter to select a type of file (default = *.*)
Example '*.PCE'
Returns
SPI_YES / SPI_NO
Remarks
Don't forget to close the catalog after using
strcpy(name,'init');
ier := ICALL(SPI_FIL_open_filcat,'c:\temp','*.TXT');
WHILE ( name[0] <> chr(0) ) DO
BEGIN
ier := ICALL (SPI_FIL_get_filcat,name);
{ action with name }
END;
ier := ICALL(SPI_FIL_close_filcat);
int SPI_FIL_open_filcat(const std::string &dir, const std::string &pattern)
Creates the catalog of files contained in a directory and who respond to the desired mask.
Definition sp_fil02.c:229
See also
SPI_FIL_close_filcat, SPI_FIL_get_filcat

◆ SPI_FIL_remove_extension()

int SPI_FIL_remove_extension ( const std::string & fileIn,
std::string & fileOut )

Removes the file extension.

Version
6.05
Parameters
[in]fileInInput file
[out]fileOutOutput file
Returns
SPI_YES
ier := ICALL(SPI_FIL_remove_extension,'toto.txt',newfile);
{ newfile = 'toto' }
int SPI_FIL_remove_extension(const std::string &fileIn, std::string &fileOut)
Removes the file extension.
Definition sp_fil02.c:855

◆ SPI_FIL_remove_tool_extension()

int SPI_FIL_remove_tool_extension ( const std::string & fileIn,
std::string & fileOut )

Removes the tool file extension (if filename is with a tool extension)

Version
6.08
Parameters
[in]fileInInput file
[out]fileOutOutput file
Returns
SPI_YES
ier := ICALL(SPI_FIL_remove_extension,'toto.F01',newfile);
{ newfile = 'toto' }
ier := ICALL(SPI_FIL_remove_extension,'toto_diam10.05',newfile);
{ newfile = 'toto_diam10.05' }

◆ SPI_FIL_select_directory()

int SPI_FIL_select_directory ( std::string & folder)

Calls file browser to select a directory.

Version
4.4
Parameters
[in,out]foldername of the directory
Returns
SPI_YES / SPI_NO
strcpy(dirname,'c\temp');
ier := ICALL(SPI_FIL_select_directory,dirname);
int SPI_FIL_select_directory(std::string &folder)
Calls file browser to select a directory.
Definition sp_fil02.c:1016

◆ SPI_FIL_select_file()

int SPI_FIL_select_file ( int mode,
const std::string & ext,
int flagMosaic,
std::string & dir,
std::string & name )

Calls file browser to select a file.

Version
4.4
Parameters
[in]modeOption to select a file
  • 0: Read
  • 1: Write
  • 2: Erase
[in]extFile extension
[in]flagMosaicdraw the picture (SPI_YES,SPI_NO)
[in,out]dirname of the directory
[in,out]namename of the file
Returns
SPI_YES / SPI_NO
strcpy(dirname,'c:\temp');
ier := ICALL(SPI_FIL_select_file,0,'TXT',SPI_YES,dirname,filename);
int SPI_FIL_select_file(int mode, const std::string &ext, int flagMosaic, std::string &dir, std::string &name)
Calls file browser to select a file.
Definition sp_fil02.c:437

◆ SPI_FIL_test_file()

int SPI_FIL_test_file ( const std::string & dirName,
const std::string & fileName,
int mode )

Checks the presence and attributes of a file or directory.

Version
4.4
Parameters
[in]dirNamename of the directory
[in]fileNamename of the file
[in]mode
  • SPI_FIL_MODE_READ: option to read a file
  • SPI_FIL_MODE_WRITE option to write a file
  • SPI_DIR_MODE_READ: option to read a directory
  • SPI_DIR_MODE_WRITE option to write a directory
Returns
SPI_YES / SPI_NO
ier := ICALL(SPI_FIL_test_file,'c:\temp','ruban.txt',SPI_FIL_MODE_WRITE);
int SPI_FIL_test_file(const std::string &dirName, const std::string &fileName, int mode)
Checks the presence and attributes of a file or directory.
Definition sp_fil02.c:490