Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
Cf_Fat_Assign
198
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function Cf_Fat_Assign(dim byref filename as char[12], dim
file_cre_attr 
as byteas byte
Returns
0
if file does not exist and no new file is created. 
1
if file already exists or file does not exist but a new file is created. 
Description
Assigns file for file operations (read, write, delete...). All subsequent file opera-
tions will be applied to the assigned file.
Parameters : 
filename:
name of the file that should be assigned for file operations. The file  
name should be in DOS 8.3 (file_name.extension) format. The file name and 
extension will be automatically padded with spaces by the library if they have 
less than length required (i.e. "mikro.tx" -> "mikro .tx "), so the user does not 
have to take care of that. The file name and extension are case insensitive.  
The library will convert them to the proper case automatically, so the user does  
not have to take care of that. 
Also, in order to keep backward compatibility with the first version of this  
library, file names can be entered as UPPERCASE string of 11 bytes in length 
with no dot character between the file name and extension (i.e.  
"MIKROELETXT" -> MIKROELE.TXT). In this case the last 3 characters of the  
string are considered to be file extension.
file_cre_attr:
file creation and attributs flags. Each bit corresponds to the 
appropriate file attribut: 
Note: Long File Names (LFN) are not supported. 
Requires
CF card and CF library must be initialized for file operations. See Cf_Fat_Init. 
Example
' create file with archive attribut if it does not already exist
Cf_Fat_Assign('MIKRO007.TXT',0xA0)
Bit
Mask
Description
0
0x01
Read Only
1
0x02
Hidden
2
0x04
System
3
0x08
Volume Label
4
0x10
Subdirectory
5
0x20
Archive
6
0x40
Device (internal use only, never found on disk)
7
0x80
File creation flag. If the file does not exist and this flag is set,
a new file with specified name will be created.